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