From 20c13aa1fdd1d71936cc00f5cb5d973663cb47bb Mon Sep 17 00:00:00 2001 From: Mojtaba-z Date: Sat, 22 Nov 2025 14:19:41 +0330 Subject: [PATCH] revert - update inventory_received on parents & registerer org --- apps/product/services/quota_stat_service.py | 6 +++++- apps/warehouse/services/warehouse_allocation_service.py | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) 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)