From a87670e14ec4d57591b1405cade6a3ca499ec10a Mon Sep 17 00:00:00 2001 From: Mojtaba-z Date: Tue, 25 Nov 2025 10:40:16 +0330 Subject: [PATCH] add - distributions list by quota in my child orgs --- apps/product/web/api/v1/viewsets/quota_api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/product/web/api/v1/viewsets/quota_api.py b/apps/product/web/api/v1/viewsets/quota_api.py index 22981f3..7651f49 100644 --- a/apps/product/web/api/v1/viewsets/quota_api.py +++ b/apps/product/web/api/v1/viewsets/quota_api.py @@ -8,6 +8,7 @@ from rest_framework.decorators import action from rest_framework.exceptions import APIException from rest_framework.response import Response +from apps.authentication.services.service import get_all_org_child from apps.core.api import BaseViewSet from apps.core.mixins.search_mixin import DynamicSearchMixin from apps.core.mixins.soft_delete_mixin import SoftDeleteMixin @@ -433,11 +434,13 @@ class QuotaViewSet(BaseViewSet, SoftDeleteMixin, viewsets.ModelViewSet, DynamicS """ list of distributions by quota """ my_org = get_organization_by_user(request.user) + my_org_child_list = get_all_org_child(my_org) try: quota = self.get_object() queryset = self.filter_query( quota.distributions_assigned.filter( - assigner_organization=my_org + Q(assigner_organization=my_org) | + Q(assigned_organization__in=my_org_child_list) ).order_by('-modify_date') ) # return by search param or all objects