change retrieve function in quota

This commit is contained in:
2025-11-16 15:51:15 +03:30
parent 13f3c90f50
commit 450a02dda1
3 changed files with 20 additions and 4 deletions

View File

@@ -822,12 +822,12 @@ class OrganizationQuotaStats(BaseModel):
""" calculate total/sold/remaining """
from apps.warehouse.models import InventoryQuotaSaleItem
if not main_quota:
if main_quota:
# calculate total amount of distribution
self.total_amount = self.distributions.filter().aggregate(
total=Sum('weight')
)['total'] or 0
print(self.total_amount)
self.total_distributed = self.distributions.filter().exclude(
assigned_organization=self.organization
).aggregate(total=Sum('weight'))['total'] or 0