[UPDT] PAYROLL: Updated payroll reimbursement form

This commit is contained in:
Horilla
2025-07-31 15:18:43 +05:30
parent da06922424
commit 4cb5801674
3 changed files with 35 additions and 21 deletions

View File

@@ -810,6 +810,9 @@ class ReimbursementForm(ModelForm):
def get_employee(self):
"""Resolves employee either from form data or request."""
if hasattr(self.instance, "employee_id") and self.instance.employee_id:
return self.instance.employee_id
employee_qs = self.fields["employee_id"].queryset
employee_id = self.data.get("employee_id") if self.data else None
@@ -852,7 +855,7 @@ class ReimbursementForm(ModelForm):
self.fields["attachment"] = MultipleFileField(label="Attachments")
self.fields["attachment"].widget.attrs["accept"] = ".jpg, .jpeg, .png, .pdf"
self.exclude_fields_by_type(exclude_fields)
# self.exclude_fields_by_type(exclude_fields)
for field in exclude_fields:
self.fields.pop(field, None)
@@ -901,9 +904,6 @@ class ReimbursementForm(ModelForm):
"ad_to_encash",
]
if is_edit:
exclude_fields += ["type", "employee_id"]
def as_p(self):
"""
Render the form fields as HTML table rows with Bootstrap styling.