Merge remote-tracking branch 'origin/fix_city' into production

This commit is contained in:
Hadi 2025-10-28 13:06:56 +03:30
commit 3752438630

View file

@ -21,7 +21,7 @@ def scope_instances_queryset(user, queryset=None):
if profile.has_role(UserRoles.BROKER):
return qs.filter(broker=profile.broker)
if profile.has_role(UserRoles.ACCOUNTANT) or profile.has_role(UserRoles.MANAGER) or profile.has_role(UserRoles.WATER_RESOURCE_MANAGER):
return qs.filter(broker__affairs__county=profile.county)
return qs.filter(broker__affairs__county__city=profile.county.city)
if profile.has_role(UserRoles.ADMIN):
return qs
# if profile.has_role(UserRoles.WATER_RESOURCE_MANAGER) or profile.has_role(UserRoles.HEADQUARTER):
@ -70,7 +70,7 @@ def scope_wells_queryset(user, queryset=None):
if profile.has_role(UserRoles.BROKER):
return qs.filter(broker=profile.broker)
if profile.has_role(UserRoles.ACCOUNTANT) or profile.has_role(UserRoles.MANAGER) or profile.has_role(UserRoles.WATER_RESOURCE_MANAGER):
return qs.filter(broker__affairs__county=profile.county)
return qs.filter(broker__affairs__county__city=profile.county.city)
if profile.has_role(UserRoles.INSTALLER):
# Wells that have instances assigned to this installer
from installations.models import InstallationAssignment
@ -103,7 +103,7 @@ def scope_customers_queryset(user, queryset=None):
if profile.has_role(UserRoles.BROKER):
return qs.filter(broker=profile.broker)
if profile.has_role(UserRoles.ACCOUNTANT) or profile.has_role(UserRoles.MANAGER) or profile.has_role(UserRoles.WATER_RESOURCE_MANAGER):
return qs.filter(county=profile.county)
return qs.filter(county__city=profile.county.city)
if profile.has_role(UserRoles.INSTALLER):
# Customers that are representatives of instances assigned to this installer
from installations.models import InstallationAssignment