[UPDT] PAYROLL: Updated payroll reimbursement form
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user