add company code to organization serialzier
This commit is contained in:
@@ -294,6 +294,12 @@ class Quota(BaseModel):
|
||||
|
||||
return factor_total + broker_total + coop + factory
|
||||
|
||||
@property
|
||||
def remaining_quota_weight(self):
|
||||
""" calculate remaining quota weight after distribution """
|
||||
distributed_weight = self.distributions_assigned.aggregate(total=models.Sum("weight"))["total"] or 0
|
||||
return self.quota_weight - distributed_weight
|
||||
|
||||
def save(self, calculate_final_price=None, *args, **kwargs):
|
||||
if not self.quota_id:
|
||||
self.quota_id = self.generate_quota_id()
|
||||
@@ -424,4 +430,3 @@ class QuotaDistribution(BaseModel):
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
return super(QuotaDistribution, self).save(*args, **kwargs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user