diff --git a/apps/warehouse/web/api/v1/api.py b/apps/warehouse/web/api/v1/api.py index 590aa25..e31c9ba 100644 --- a/apps/warehouse/web/api/v1/api.py +++ b/apps/warehouse/web/api/v1/api.py @@ -6,6 +6,7 @@ from rest_framework import viewsets, filters from rest_framework.decorators import action 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 @@ -159,10 +160,14 @@ class InventoryEntryViewSet( else: org = get_organization_by_user(request.user) + # get my organization child + org_child = get_all_org_child(org) + org_child.append(org) + entries = self.get_queryset( visibility_by_org_scope=True ) if org.free_visibility_by_scope else self.get_queryset().filter( - organization=org, + organization__in=org_child, ) queryset = self.filter_query( self.filter_queryset(entries.filter(quota_id=pk))) # return by search param or all objects