add some new data to device login data, first part of broker to stake holders assignment
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import datetime
|
||||
from apps.product.web.api.v1.serializers import product_serializers as product_serializers
|
||||
from apps.product.web.api.v1.serializers import quota_serializers
|
||||
from apps.core.mixins.soft_delete_mixin import SoftDeleteMixin
|
||||
from common.helpers import get_organization_by_user
|
||||
from rest_framework.exceptions import APIException
|
||||
from apps.product import models as product_models
|
||||
@@ -26,7 +27,7 @@ def delete(queryset, pk):
|
||||
obj.delete()
|
||||
|
||||
|
||||
class ProductCategoryViewSet(viewsets.ModelViewSet):
|
||||
class ProductCategoryViewSet(viewsets.ModelViewSet, SoftDeleteMixin):
|
||||
queryset = product_models.ProductCategory.objects.all()
|
||||
serializer_class = product_serializers.ProductCategorySerializer
|
||||
filter_backends = [filters.SearchFilter]
|
||||
@@ -64,7 +65,7 @@ class ProductCategoryViewSet(viewsets.ModelViewSet):
|
||||
return Response(e, status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class ProductViewSet(viewsets.ModelViewSet):
|
||||
class ProductViewSet(viewsets.ModelViewSet, SoftDeleteMixin):
|
||||
queryset = product_models.Product.objects.all()
|
||||
serializer_class = product_serializers.ProductSerializer
|
||||
filter_backends = [filters.SearchFilter]
|
||||
@@ -143,7 +144,7 @@ class ProductViewSet(viewsets.ModelViewSet):
|
||||
return Response(e, status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class ProductStatsViewSet(viewsets.ModelViewSet):
|
||||
class ProductStatsViewSet(viewsets.ModelViewSet, SoftDeleteMixin):
|
||||
""" product statistics by its quotas """
|
||||
|
||||
queryset = product_models.ProductStats.objects.all()
|
||||
@@ -174,7 +175,7 @@ class ProductStatsViewSet(viewsets.ModelViewSet):
|
||||
raise e
|
||||
|
||||
|
||||
class AttributeViewSet(viewsets.ModelViewSet):
|
||||
class AttributeViewSet(viewsets.ModelViewSet, SoftDeleteMixin):
|
||||
""" attributes of reference product """ #
|
||||
|
||||
queryset = product_models.Attribute.objects.select_related('product').all()
|
||||
@@ -232,7 +233,7 @@ class AttributeViewSet(viewsets.ModelViewSet):
|
||||
return Response(e, status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class AttributeValueViewSet(viewsets.ModelViewSet):
|
||||
class AttributeValueViewSet(viewsets.ModelViewSet, SoftDeleteMixin):
|
||||
""" apis for attribute values of child products """ # noqa
|
||||
|
||||
queryset = product_models.AttributeValue.objects.all()
|
||||
@@ -270,7 +271,7 @@ class AttributeValueViewSet(viewsets.ModelViewSet):
|
||||
return Response(e, status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class BrokerViewSet(viewsets.ModelViewSet):
|
||||
class BrokerViewSet(viewsets.ModelViewSet, SoftDeleteMixin):
|
||||
""" apis of product brokers """ # noqa
|
||||
|
||||
queryset = product_models.Broker.objects.all()
|
||||
@@ -310,7 +311,7 @@ class BrokerViewSet(viewsets.ModelViewSet):
|
||||
return Response(e, status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class SaleUnitViewSet(viewsets.ModelViewSet):
|
||||
class SaleUnitViewSet(viewsets.ModelViewSet, SoftDeleteMixin):
|
||||
""" apis of unit of sale for products """ # noqa
|
||||
|
||||
queryset = product_models.SaleUnit.objects.all()
|
||||
@@ -350,7 +351,7 @@ class SaleUnitViewSet(viewsets.ModelViewSet):
|
||||
return Response(e, status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class IncentivePlanViewSet(viewsets.ModelViewSet): # noqa
|
||||
class IncentivePlanViewSet(viewsets.ModelViewSet, SoftDeleteMixin): # noqa
|
||||
""" apis for incentive plan """
|
||||
|
||||
queryset = product_models.IncentivePlan.objects.all()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from apps.product.web.api.v1.serializers import quota_distribution_serializers
|
||||
from apps.product.services.services import get_products_in_warehouse
|
||||
from apps.product.web.api.v1.serializers import quota_serializers
|
||||
from apps.core.mixins.soft_delete_mixin import SoftDeleteMixin
|
||||
from apps.product.exceptions import QuotaExpiredTimeException
|
||||
from apps.core.mixins.search_mixin import DynamicSearchMixin
|
||||
from apps.core.pagination import CustomPageNumberPagination
|
||||
@@ -31,7 +32,7 @@ def delete(queryset, pk):
|
||||
obj.delete()
|
||||
|
||||
|
||||
class QuotaViewSet(viewsets.ModelViewSet, DynamicSearchMixin): # noqa
|
||||
class QuotaViewSet(viewsets.ModelViewSet, DynamicSearchMixin, SoftDeleteMixin): # noqa
|
||||
""" apis for product quota """
|
||||
|
||||
queryset = product_models.Quota.objects.all()
|
||||
@@ -453,7 +454,7 @@ class QuotaViewSet(viewsets.ModelViewSet, DynamicSearchMixin): # noqa
|
||||
return Response(e, status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class QuotaIncentiveAssignmentViewSet(viewsets.ModelViewSet): # noqa
|
||||
class QuotaIncentiveAssignmentViewSet(viewsets.ModelViewSet, SoftDeleteMixin): # noqa
|
||||
""" apis for incentive assignment """
|
||||
|
||||
queryset = product_models.QuotaIncentiveAssignment.objects.all()
|
||||
@@ -491,7 +492,7 @@ class QuotaIncentiveAssignmentViewSet(viewsets.ModelViewSet): # noqa
|
||||
return Response(e, status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class QuotaBrokerValueViewSet(viewsets.ModelViewSet): # noqa
|
||||
class QuotaBrokerValueViewSet(viewsets.ModelViewSet, SoftDeleteMixin): # noqa
|
||||
""" apis for quota broker value """
|
||||
|
||||
queryset = product_models.QuotaBrokerValue.objects.all()
|
||||
@@ -529,7 +530,7 @@ class QuotaBrokerValueViewSet(viewsets.ModelViewSet): # noqa
|
||||
return Response(e, status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class QuotaLiveStockAllocationViewSet(viewsets.ModelViewSet):
|
||||
class QuotaLiveStockAllocationViewSet(viewsets.ModelViewSet, SoftDeleteMixin):
|
||||
""" apis for quota livestock allocation """
|
||||
|
||||
queryset = product_models.QuotaLivestockAllocation.objects.all()
|
||||
@@ -567,7 +568,7 @@ class QuotaLiveStockAllocationViewSet(viewsets.ModelViewSet):
|
||||
return Response(e, status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class QuotaLiveStockAgeLimitation(viewsets.ModelViewSet):
|
||||
class QuotaLiveStockAgeLimitation(viewsets.ModelViewSet, SoftDeleteMixin):
|
||||
queryset = product_models.QuotaLiveStockAgeLimitation.objects.all() # noqa
|
||||
serializer_class = quota_serializers.QuotaLiveStockAgeLimitationSerializer
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from apps.product.web.api.v1.serializers import quota_distribution_serializers as distribution_serializers
|
||||
from apps.core.mixins.soft_delete_mixin import SoftDeleteMixin
|
||||
from apps.core.mixins.search_mixin import DynamicSearchMixin
|
||||
from apps.core.pagination import CustomPageNumberPagination
|
||||
from rest_framework.exceptions import APIException
|
||||
@@ -26,7 +27,7 @@ def delete(queryset, pk):
|
||||
obj.delete()
|
||||
|
||||
|
||||
class QuotaDistributionViewSet(viewsets.ModelViewSet, DynamicSearchMixin):
|
||||
class QuotaDistributionViewSet(viewsets.ModelViewSet, DynamicSearchMixin, SoftDeleteMixin):
|
||||
""" quota distribution apis """
|
||||
|
||||
queryset = product_models.QuotaDistribution.objects.all()
|
||||
|
||||
Reference in New Issue
Block a user