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

This commit is contained in:
Hadi 2025-09-14 11:57:22 +03:30
commit 896d66e801
3 changed files with 12 additions and 3 deletions

View file

@ -459,7 +459,8 @@
'id_national_code': customer.national_code,
'id_card_number': customer.card_number,
'id_account_number': customer.account_number,
'id_address': customer.address
'id_address': customer.address,
'id_bank_name': customer.bank_name
};
// Loop through fields for easier maintenance
@ -471,6 +472,11 @@
$('#exampleModalLabel').text('ویرایش کاربر');
$('.data-submit').text('ویرایش');
// Ensure select value is applied (for some browsers/plugins)
if (customer.bank_name !== undefined && customer.bank_name !== null) {
$('#id_bank_name').val(customer.bank_name);
}
// Open modal
$('#add-new-record').offcanvas('show');
} else {

Binary file not shown.

View file

@ -3,6 +3,7 @@ from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from .models import Well, WaterMeterManufacturer
from locations.models import Affairs, County, Broker
from common.consts import UserRoles
class WaterMeterManufacturerForm(forms.ModelForm):
@ -118,8 +119,10 @@ class WellForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# تنظیم querysetها
self.fields['representative'].queryset = get_user_model().objects.all()
# تنظیم querysetها - فقط کاربرانی که نقش مشترک دارند
self.fields['representative'].queryset = get_user_model().objects.filter(
profile__roles__slug=UserRoles.CUSTOMER.value
)
self.fields['water_meter_manufacturer'].queryset = WaterMeterManufacturer.objects.all()
# اضافه کردن گزینه خالی