fix - connect fields of distribution with org quota stat
This commit is contained in:
@@ -94,6 +94,16 @@ class QuotaDistributionSerializer(serializers.ModelSerializer):
|
|||||||
""" Custom output of serializer """
|
""" Custom output of serializer """
|
||||||
|
|
||||||
representation = super().to_representation(instance)
|
representation = super().to_representation(instance)
|
||||||
|
|
||||||
|
# get org quota stat detail
|
||||||
|
quotas_stat_amount = instance.quota.quota_amount_by_org(instance.assigned_organization)
|
||||||
|
|
||||||
|
representation['remaining_weight'] = quotas_stat_amount['remaining_weight']
|
||||||
|
representation['distributed'] = quotas_stat_amount['quota_distributed']
|
||||||
|
representation['warehouse_entry'] = quotas_stat_amount['inventory_received']
|
||||||
|
representation['warehouse_balance'] = quotas_stat_amount['inventory_entry_balance']
|
||||||
|
representation['been_sold'] = quotas_stat_amount['been_sold']
|
||||||
|
|
||||||
if instance.quota:
|
if instance.quota:
|
||||||
representation['quota'] = QuotaSerializer(instance.quota).data
|
representation['quota'] = QuotaSerializer(instance.quota).data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user