fix - exclude self org & admin in visible orgs

This commit is contained in:
2025-11-02 14:49:47 +03:30
parent 4ea8f77b58
commit 693b5e1b24
2 changed files with 8 additions and 1 deletions

View File

@@ -13,7 +13,10 @@ def get_visible_organizations(org: Organization) -> typing.Any:
if org.free_visibility_by_scope:
if org.field_of_activity == 'CO':
return Organization.objects.all()
if org.type.key == 'ADM':
return Organization.objects.all()
else:
return Organization.objects.all().exclude(id=org.id).exclude(type__key='ADM')
elif org.field_of_activity == 'CI':
return Organization.objects.filter(city=org.city)

View File

@@ -681,3 +681,7 @@ AssertionError: .validate() should return the validated data
[2025-11-02 13:35:36,007] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
[2025-11-02 13:45:12,453] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\warehouse\web\api\v1\serializers.py changed, reloading.
[2025-11-02 13:45:15,794] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
[2025-11-02 14:48:20,592] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\services\visibility_services.py changed, reloading.
[2025-11-02 14:48:23,704] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader
[2025-11-02 14:49:21,133] INFO django.utils.autoreload | IP: - | Path: - | D:\Project\Rasaddam_Backend\apps\authentication\services\visibility_services.py changed, reloading.
[2025-11-02 14:49:23,410] INFO django.utils.autoreload | IP: - | Path: - | Watching for file changes with StatReloader