fix - inventory entry lists in page
This commit is contained in:
@@ -6,6 +6,7 @@ from rest_framework import viewsets, filters
|
|||||||
from rest_framework.decorators import action
|
from rest_framework.decorators import action
|
||||||
from rest_framework.response import Response
|
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.api import BaseViewSet
|
||||||
from apps.core.mixins.search_mixin import DynamicSearchMixin
|
from apps.core.mixins.search_mixin import DynamicSearchMixin
|
||||||
from apps.core.mixins.soft_delete_mixin import SoftDeleteMixin
|
from apps.core.mixins.soft_delete_mixin import SoftDeleteMixin
|
||||||
@@ -159,10 +160,14 @@ class InventoryEntryViewSet(
|
|||||||
else:
|
else:
|
||||||
org = get_organization_by_user(request.user)
|
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(
|
entries = self.get_queryset(
|
||||||
visibility_by_org_scope=True
|
visibility_by_org_scope=True
|
||||||
) if org.free_visibility_by_scope else self.get_queryset().filter(
|
) if org.free_visibility_by_scope else self.get_queryset().filter(
|
||||||
organization=org,
|
organization__in=org_child,
|
||||||
)
|
)
|
||||||
queryset = self.filter_query(
|
queryset = self.filter_query(
|
||||||
self.filter_queryset(entries.filter(quota_id=pk))) # return by search param or all objects
|
self.filter_queryset(entries.filter(quota_id=pk))) # return by search param or all objects
|
||||||
|
|||||||
Reference in New Issue
Block a user