fix - transaction & show users with my organization except me

This commit is contained in:
2025-11-01 14:20:27 +03:30
parent 0f6e1ecd28
commit f8320b6e44
4 changed files with 50 additions and 12 deletions

View File

@@ -36,7 +36,9 @@ class BaseViewSet(RegionFilterMixin, viewsets.ModelViewSet):
model_name = queryset.model.__name__.lower()
if model_name == 'userrelations': # noqa
queryset = (queryset.filter(organization__in=child_orgs))
# add all users with my organization except my user
child_orgs.append(org)
queryset = (queryset.filter(organization__in=child_orgs).exclude(user=user))
elif model_name == 'organization':
queryset = queryset.filter(id__in=[org.id for org in child_orgs])