deploy product & quota base system
This commit is contained in:
@@ -3,14 +3,6 @@ from apps.product import models as product_models
|
||||
from apps.authorization.api.v1 import serializers as authorize_serializers
|
||||
|
||||
|
||||
class ReferenceProductSerializer(serializers.ModelSerializer):
|
||||
""" Serializer of reference product """
|
||||
|
||||
class Meta:
|
||||
model = product_models.ReferenceProduct
|
||||
fields = '__all__'
|
||||
|
||||
|
||||
class ProductSerializer(serializers.ModelSerializer):
|
||||
""" Serializer of product """
|
||||
|
||||
@@ -22,8 +14,6 @@ class ProductSerializer(serializers.ModelSerializer):
|
||||
""" Custom output of product serializer """
|
||||
|
||||
representation = super().to_representation(instance)
|
||||
if instance.reference:
|
||||
representation['reference'] = ReferenceProductSerializer(instance.reference).data
|
||||
|
||||
return representation
|
||||
|
||||
@@ -37,11 +27,6 @@ class AttributeSerializer(serializers.ModelSerializer):
|
||||
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
if instance.reference_product:
|
||||
representation['reference_product'] = ReferenceProductSerializer(
|
||||
instance.reference_product
|
||||
).data
|
||||
|
||||
return representation
|
||||
|
||||
|
||||
@@ -73,10 +58,6 @@ class BrokerSerializer(serializers.ModelSerializer):
|
||||
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
if instance.reference_product:
|
||||
representation['reference_product'] = ReferenceProductSerializer(
|
||||
instance.reference_product
|
||||
).data
|
||||
if instance.organization_relations:
|
||||
representation['organization_relations'] = authorize_serializers.UserRelationSerializer(
|
||||
instance.organization_relations
|
||||
@@ -94,9 +75,34 @@ class SaleUnitSerializer(serializers.ModelSerializer):
|
||||
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
if instance.reference_product:
|
||||
representation['reference_product'] = ReferenceProductSerializer(
|
||||
instance.reference_product
|
||||
).data
|
||||
|
||||
return representation
|
||||
|
||||
|
||||
class IncentivePlanSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = product_models.IncentivePlan
|
||||
fields = '__all_'
|
||||
|
||||
|
||||
class QuotaSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = product_models.Quota
|
||||
fields = '__all__'
|
||||
|
||||
|
||||
class QuotaIncentiveAssignmentSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = product_models.QuotaIncentiveAssignment
|
||||
fields = '__all__'
|
||||
|
||||
|
||||
class QuotaBrokerValueSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = product_models.QuotaBrokerValue
|
||||
fields = '__all__'
|
||||
|
||||
|
||||
class QuotaLiveStockAllocationSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = product_models.QuotaLivestockAllocation
|
||||
fields = '__all__'
|
||||
|
||||
Reference in New Issue
Block a user