From cafe40520a384fc7139a24aecb8f85120cd40636 Mon Sep 17 00:00:00 2001 From: Cybrosys Odoo Devs <50653951+CybroOdooDev@users.noreply.github.com> Date: Fri, 8 Mar 2024 22:39:19 +0530 Subject: [PATCH] [UPDT] PAYROLL: Updated payroll filter by adding fields to filter by employee work info --- payroll/filters.py | 6 ++ payroll/forms/component_forms.py | 4 +- payroll/models/models.py | 7 +- .../contract/contract_export_filter.html | 73 +++++++++++++++---- .../payroll/contract/contract_view.html | 4 +- .../payroll/contract/filter_contract.html | 71 +++++++++++++++--- 6 files changed, 133 insertions(+), 32 deletions(-) diff --git a/payroll/filters.py b/payroll/filters.py index 110a268ff..b8db45909 100644 --- a/payroll/filters.py +++ b/payroll/filters.py @@ -78,6 +78,12 @@ class ContractFilter(FilterSet): "contract_end_date", "wage_type", "filing_status", + "employee_id__employee_work_info__company_id", + "department", + "job_position", + "job_role", + "shift", + "work_type", "pay_frequency", "contract_status", "wage", diff --git a/payroll/forms/component_forms.py b/payroll/forms/component_forms.py index 6f8c3e759..bcd35ec80 100644 --- a/payroll/forms/component_forms.py +++ b/payroll/forms/component_forms.py @@ -2,6 +2,7 @@ These forms provide a convenient way to handle data input, validation, and customization of form fields and widgets for the corresponding models in the payroll management system. """ + from typing import Any import uuid import datetime @@ -351,7 +352,7 @@ class PayslipExportColumnForm(forms.Form): ) -exclude_fields = ["id", "contract_document", "is_active", "note", "note"] +exclude_fields = ["id", "contract_document", "is_active", "note", "note", "created_at"] class ContractExportFieldForm(forms.Form): @@ -624,7 +625,6 @@ class ReimbursementForm(ModelForm): if field in self.fields: del self.fields[field] - def as_p(self): """ Render the form fields as HTML table rows with Bootstrap styling. diff --git a/payroll/models/models.py b/payroll/models/models.py index 12e8defb5..13e180a4c 100644 --- a/payroll/models/models.py +++ b/payroll/models/models.py @@ -155,9 +155,9 @@ class Contract(models.Model): related_name="contract_set", verbose_name=_("Employee"), ) - contract_start_date = models.DateField(verbose_name=_("Start date")) + contract_start_date = models.DateField(verbose_name=_("Start Date")) contract_end_date = models.DateField( - null=True, blank=True, verbose_name=_("End date") + null=True, blank=True, verbose_name=_("End Date") ) wage_type = models.CharField( choices=WAGE_CHOICES, @@ -236,8 +236,9 @@ class Contract(models.Model): ) notice_period_in_month = models.IntegerField( default=3, - help_text="Notice period in total months.", + help_text=_("Notice period in total months."), validators=[min_zero], + verbose_name = _("Notice Period") ) calculate_daily_leave_amount = models.BooleanField( default=True, diff --git a/payroll/templates/payroll/contract/contract_export_filter.html b/payroll/templates/payroll/contract/contract_export_filter.html index 8f8c3697b..f61d5e44b 100644 --- a/payroll/templates/payroll/contract/contract_export_filter.html +++ b/payroll/templates/payroll/contract/contract_export_filter.html @@ -6,7 +6,7 @@