some changes in stat / permissions add modify state
This commit is contained in:
@@ -818,14 +818,15 @@ class OrganizationQuotaStats(BaseModel):
|
||||
sold_amount = models.PositiveBigIntegerField(default=0)
|
||||
remaining_amount = models.PositiveBigIntegerField(default=0) # total - sold
|
||||
|
||||
def update_amount(self):
|
||||
def update_amount(self, main_quota=None):
|
||||
""" calculate total/sold/remaining """
|
||||
from apps.warehouse.models import InventoryQuotaSaleItem
|
||||
|
||||
# calculate total amount of distribution
|
||||
# self.total_amount = self.distributions.filter().aggregate(
|
||||
# total=Sum('weight')
|
||||
# )['total'] or 0
|
||||
if not main_quota:
|
||||
# calculate total amount of distribution
|
||||
self.total_amount = self.distributions.filter().aggregate(
|
||||
total=Sum('weight')
|
||||
)['total'] or 0
|
||||
|
||||
self.total_distributed = self.distributions.filter().exclude(
|
||||
assigned_organization=self.organization
|
||||
|
||||
Reference in New Issue
Block a user