change retrieve function in quota
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user