add - new changes on OrganizationQuotaStat & calculative signals on quota/distribution
This commit is contained in:
@@ -15,9 +15,19 @@ class QuotaSerializer(serializers.ModelSerializer):
|
||||
|
||||
# change quota weight by organization received weight
|
||||
if 'org' in self.context.keys():
|
||||
quota_weight_by_org = instance.quota_amount_by_org(self.context['org'])
|
||||
org = self.context['org']
|
||||
quota_weight_by_org = instance.quota_amount_by_org(org)
|
||||
if quota_weight_by_org:
|
||||
representation['quota_weight'] = quota_weight_by_org
|
||||
representation['quota_weight'] = quota_weight_by_org['quota_weight']
|
||||
representation['quota_distributed'] = quota_weight_by_org['quota_distributed']
|
||||
representation['remaining_weight'] = quota_weight_by_org['remaining_weight']
|
||||
representation['been_sold'] = quota_weight_by_org['been_sold']
|
||||
representation['distributions'] = [{
|
||||
"id": dist.id,
|
||||
"organization": org.name,
|
||||
"organization_id": org.id,
|
||||
"weight": dist.weight,
|
||||
} for dist in instance.distributions_assigned.all()]
|
||||
|
||||
if isinstance(instance, product_models.Quota):
|
||||
if instance.sale_unit:
|
||||
|
||||
Reference in New Issue
Block a user