pos client & quota limit organization blank
This commit is contained in:
@@ -121,7 +121,12 @@ class SaleUnitSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = product_models.SaleUnit
|
||||
fields = '__all__'
|
||||
fields = [
|
||||
"id",
|
||||
"product",
|
||||
"unit",
|
||||
"required",
|
||||
]
|
||||
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
|
||||
@@ -14,6 +14,10 @@ class QuotaSerializer(serializers.ModelSerializer):
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
if isinstance(instance, product_models.Quota):
|
||||
if instance.sale_unit:
|
||||
representation['sale_unit'] = product_serializers.SaleUnitSerializer(
|
||||
instance.sale_unit
|
||||
).data
|
||||
representation['incentive_plan'] = QuotaIncentiveAssignmentSerializer(
|
||||
instance.incentive_assignments.all(),
|
||||
many=True
|
||||
|
||||
Reference in New Issue
Block a user