fix - list of pricing features in quota
This commit is contained in:
@@ -529,6 +529,24 @@ class Quota(BaseModel):
|
||||
"inventory_entry_balance": stat.first().inventory_entry_balance if stat.exists() else 0,
|
||||
}
|
||||
|
||||
def get_quota_stat(self, org: Organization):
|
||||
"""
|
||||
get stats of quota from org quota stat model
|
||||
"""
|
||||
|
||||
stat = OrganizationQuotaStats.objects.filter(
|
||||
quota=self,
|
||||
organization=org
|
||||
)
|
||||
|
||||
if not stat.exists() and org.type.key == 'ADM':
|
||||
# if org is admin just see the quota was created by registerer org
|
||||
org = self.registerer_organization
|
||||
stat = OrganizationQuotaStats.objects.filter(
|
||||
quota=self,
|
||||
)
|
||||
return stat.first()
|
||||
|
||||
def soft_delete(self):
|
||||
self.trash = True
|
||||
self.save(update_fields=['trash'])
|
||||
|
||||
Reference in New Issue
Block a user