Правки логики

This commit is contained in:
2026-09-21 20:37:18 +03:00
parent f653a06820
commit 536679925a
30 changed files with 447 additions and 191 deletions
+5 -1
View File
@@ -69,7 +69,7 @@ class PortalPharmacyEditForm(forms.ModelForm):
'curator': forms.Select(attrs={'class': 'input'}),
}
def __init__(self, *args, **kwargs):
def __init__(self, *args, user=None, **kwargs):
super().__init__(*args, **kwargs)
from apps.employees.models import Employee
@@ -98,3 +98,7 @@ class PortalPharmacyEditForm(forms.ModelForm):
self.fields['building'].required = False
self.fields['apartment'].required = False
self.fields['location'].required = False
if user is not None and not user.has_perm('locations.manage_location_access'):
for field in ('head_pharmacist', 'responsible_manager', 'curator'):
self.fields.pop(field, None)