diff --git a/apps/product/services/quota_stat_service.py b/apps/product/services/quota_stat_service.py index d5a236e..ddd3896 100644 --- a/apps/product/services/quota_stat_service.py +++ b/apps/product/services/quota_stat_service.py @@ -138,7 +138,11 @@ class QuotaStatsService: stat_queryset = OrganizationQuotaStats.objects.select_related('quota', 'organization') update_my_remaining_stat = True - parent_orgs = [org] + parent_orgs = [] + + while org: + parent_orgs.append(org) + org = org.parent_organization parent_orgs_ids = [org.id for org in parent_orgs] diff --git a/apps/warehouse/services/warehouse_allocation_service.py b/apps/warehouse/services/warehouse_allocation_service.py index 1edb408..7a909dc 100644 --- a/apps/warehouse/services/warehouse_allocation_service.py +++ b/apps/warehouse/services/warehouse_allocation_service.py @@ -55,7 +55,13 @@ class WarehouseAllocationService: status.HTTP_400_BAD_REQUEST ) - parent_orgs = [entry.quota.registerer_organization] + org = entry.organization.parent_organization + parent_orgs = [] + while org: + # import parent org to list + parent_orgs.append(org) + org = org.parent_organization + parent_org_ids = [org.id for org in parent_orgs] target_org_ids = set(parent_org_ids)