refactor organization type filter in ProviderCompanyViewSet to use 'AGC'
This commit is contained in:
@@ -1,32 +1,34 @@
|
|||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from apps.product.web.api.v1.viewsets.quota_distribution_api import QuotaDistributionViewSet
|
|
||||||
from apps.pos_device.web.api.v1.serilaizers import device as device_serializer
|
from django.db import transaction
|
||||||
from apps.authentication.exceptions import OrganizationBankAccountException
|
from django.utils.timezone import now
|
||||||
from apps.authorization.api.v1.serializers import UserRelationSerializer
|
from rest_framework import status
|
||||||
from apps.pos_device.web.api.v1.viewsets.client import POSClientViewSet
|
from rest_framework import viewsets
|
||||||
from apps.core.mixins.soft_delete_mixin import SoftDeleteMixin
|
from rest_framework.decorators import action
|
||||||
|
from rest_framework.exceptions import APIException
|
||||||
|
from rest_framework.response import Response
|
||||||
|
|
||||||
from apps.authentication.api.v1.api import (
|
from apps.authentication.api.v1.api import (
|
||||||
Organization,
|
Organization,
|
||||||
BankAccountInformation,
|
BankAccountInformation,
|
||||||
OrganizationSerializer
|
OrganizationSerializer
|
||||||
)
|
)
|
||||||
from apps.core.mixins.search_mixin import DynamicSearchMixin
|
from apps.authentication.exceptions import OrganizationBankAccountException
|
||||||
from apps.core.mixins.admin_mixin import AdminFilterMixin
|
from apps.authorization.api.v1.serializers import UserRelationSerializer
|
||||||
from apps.authorization.models import UserRelations
|
from apps.authorization.models import UserRelations
|
||||||
from common.helpers import get_organization_by_user
|
from apps.core.mixins.admin_mixin import AdminFilterMixin
|
||||||
from rest_framework.exceptions import APIException
|
from apps.core.mixins.search_mixin import DynamicSearchMixin
|
||||||
|
from apps.core.mixins.soft_delete_mixin import SoftDeleteMixin
|
||||||
from apps.pos_device import models as pos_models
|
from apps.pos_device import models as pos_models
|
||||||
from rest_framework.response import Response
|
from apps.pos_device.web.api.v1.serilaizers import device as device_serializer
|
||||||
from rest_framework.decorators import action
|
from apps.pos_device.web.api.v1.viewsets.client import POSClientViewSet
|
||||||
from common.tools import CustomOperations
|
|
||||||
from common.helpers import generate_code
|
|
||||||
from apps.product.models import Broker
|
from apps.product.models import Broker
|
||||||
from django.utils.timezone import now
|
from apps.product.web.api.v1.viewsets.quota_distribution_api import QuotaDistributionViewSet
|
||||||
from rest_framework import viewsets
|
from common.helpers import generate_code
|
||||||
from django.db import transaction
|
from common.helpers import get_organization_by_user
|
||||||
from rest_framework import status
|
from common.tools import CustomOperations
|
||||||
|
|
||||||
|
|
||||||
class ProviderCompanyViewSet(SoftDeleteMixin, viewsets.ModelViewSet): # noqa
|
class ProviderCompanyViewSet(SoftDeleteMixin, viewsets.ModelViewSet): # noqa
|
||||||
@@ -354,7 +356,7 @@ class StakeHoldersViewSet(SoftDeleteMixin, viewsets.ModelViewSet, DynamicSearchM
|
|||||||
|
|
||||||
stakeholders = self.queryset.filter(
|
stakeholders = self.queryset.filter(
|
||||||
assignment__client__organization=org,
|
assignment__client__organization=org,
|
||||||
organization__type__key='CMP'
|
organization__type__key='AGC'
|
||||||
)
|
)
|
||||||
|
|
||||||
# paginate stakeholders
|
# paginate stakeholders
|
||||||
@@ -438,4 +440,3 @@ class StakeHolderShareAmountViewSet(SoftDeleteMixin, viewsets.ModelViewSet, Dyna
|
|||||||
if page is not None:
|
if page is not None:
|
||||||
serializer = self.get_serializer(page, many=True)
|
serializer = self.get_serializer(page, many=True)
|
||||||
return self.get_paginated_response(serializer.data)
|
return self.get_paginated_response(serializer.data)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user