fix - list of pricing features in quota

This commit is contained in:
2025-12-02 14:39:42 +03:30
parent 8f2d321064
commit 012a4240f1
2 changed files with 23 additions and 2 deletions

View File

@@ -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'])