diff --git a/payroll/forms/component_forms.py b/payroll/forms/component_forms.py index a412e8f65..4858c1cfe 100644 --- a/payroll/forms/component_forms.py +++ b/payroll/forms/component_forms.py @@ -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. diff --git a/payroll/templates/payroll/reimbursement/attachments.html b/payroll/templates/payroll/reimbursement/attachments.html index c35a3aa76..3772dede9 100644 --- a/payroll/templates/payroll/reimbursement/attachments.html +++ b/payroll/templates/payroll/reimbursement/attachments.html @@ -1,16 +1,33 @@ {% load i18n %} +{% load static %}

{% trans 'Attachments' %}

-{% for attachment in reimbursement.other_attachments.all %} -
-
- - -
- -
+{% if not reimbursement.other_attachments.all %} +
+ Page not found. 404. +

{% trans "No Files found." %}

+

{% trans "No files available at the moment." %}

+
+{% endif %} + +{% for attachment in reimbursement.other_attachments.all %} +
+
+ + +
+ +
{% endfor %} +
- +
diff --git a/payroll/templates/payroll/reimbursement/reimbursement_comment.html b/payroll/templates/payroll/reimbursement/reimbursement_comment.html index 97bca9945..a56f4e7ea 100644 --- a/payroll/templates/payroll/reimbursement/reimbursement_comment.html +++ b/payroll/templates/payroll/reimbursement/reimbursement_comment.html @@ -95,13 +95,10 @@ {% endfor %} {% else %} -
-
-
- {% trans "There are no comments to show." %} - -
-
-
+
+ Page not found. 404. +

{% trans "No Records found." %}

+

{% trans "No comments available at the moment." %}

+
{% endif %}