fix - warehouse allocation service
This commit is contained in:
@@ -37,6 +37,7 @@ class QuotaSerializer(serializers.ModelSerializer):
|
|||||||
representation['remaining_weight'] = quota_weight_by_org['remaining_weight']
|
representation['remaining_weight'] = quota_weight_by_org['remaining_weight']
|
||||||
representation['been_sold'] = quota_weight_by_org['been_sold']
|
representation['been_sold'] = quota_weight_by_org['been_sold']
|
||||||
representation['inventory_received'] = quota_weight_by_org['inventory_received']
|
representation['inventory_received'] = quota_weight_by_org['inventory_received']
|
||||||
|
representation['inventory_entry_balance'] = quota_weight_by_org['inventory_entry_balance']
|
||||||
representation['distributions_number_by_me'] = instance.distributions_assigned.filter(
|
representation['distributions_number_by_me'] = instance.distributions_assigned.filter(
|
||||||
assigner_organization=org
|
assigner_organization=org
|
||||||
).count()
|
).count()
|
||||||
|
|||||||
@@ -56,10 +56,12 @@ class WarehouseAllocationService:
|
|||||||
|
|
||||||
org = entry.organization.parent_organization
|
org = entry.organization.parent_organization
|
||||||
while org:
|
while org:
|
||||||
stat = OrganizationQuotaStats.objects.get(
|
stat = OrganizationQuotaStats.objects.filter(
|
||||||
quota=entry.quota,
|
quota=entry.quota,
|
||||||
organization=org
|
organization=org
|
||||||
)
|
)
|
||||||
stat.inventory_received += entry.weight
|
if stat.exists():
|
||||||
stat.save()
|
stat = stat.first()
|
||||||
org = org.parent_organization
|
stat.inventory_received += entry.weight
|
||||||
|
stat.save()
|
||||||
|
org = org.parent_organization
|
||||||
|
|||||||
Reference in New Issue
Block a user