update test
This commit is contained in:
@@ -22,6 +22,7 @@ from rest_framework.response import Response
|
||||
from rest_framework.decorators import action
|
||||
from common.tools import CustomOperations
|
||||
from common.helpers import generate_code
|
||||
from apps.product.models import Broker
|
||||
from django.utils.timezone import now
|
||||
from rest_framework import viewsets
|
||||
from django.db import transaction
|
||||
@@ -228,17 +229,19 @@ class DeviceAssignmentViewSet(SoftDeleteMixin, viewsets.ModelViewSet):
|
||||
assignment.device.save()
|
||||
|
||||
# set organization having pos status
|
||||
if assignment.client.organization:
|
||||
assignment.client.organization.has_pos = True
|
||||
assignment.client.organization.save()
|
||||
client_org = assignment.client.organization
|
||||
if client_org:
|
||||
client_org.has_pos = True
|
||||
client_org.save()
|
||||
|
||||
# after pos device assignment, must set owner
|
||||
# as default stake holder
|
||||
pos_models.StakeHolders.objects.create(
|
||||
assignment=assignment,
|
||||
device=assignment.device,
|
||||
organization=assignment.client.organization,
|
||||
default=True
|
||||
organization=client_org,
|
||||
default=True,
|
||||
broker=Broker.objects.get(organization_type=client_org.type)
|
||||
)
|
||||
|
||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
||||
|
||||
Reference in New Issue
Block a user