From 089e07bc5321a94e23ab30c524edc916290d1bfb Mon Sep 17 00:00:00 2001 From: Mojtaba-z Date: Sat, 22 Nov 2025 14:10:49 +0330 Subject: [PATCH] fix - dont increase inventory entry of parents - just my org / registere rfg --- apps/product/services/quota_stat_service.py | 6 +----- apps/warehouse/services/warehouse_allocation_service.py | 8 +------- 2 files changed, 2 insertions(+), 12 deletions(-) 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)