diff --git a/hr_payroll_hibou/__manifest__.py b/hr_payroll_hibou/__manifest__.py index 41020cf0..31c5b903 100644 --- a/hr_payroll_hibou/__manifest__.py +++ b/hr_payroll_hibou/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'Hibou Payroll', 'author': 'Hibou Corp. ', - 'version': '13.0.2.0.0', + 'version': '13.0.2.1.0', 'category': 'Payroll Localization', 'depends': [ 'hr_payroll', diff --git a/hr_payroll_hibou/models/browsable_object.py b/hr_payroll_hibou/models/browsable_object.py index 60543eb8..1e727f1b 100644 --- a/hr_payroll_hibou/models/browsable_object.py +++ b/hr_payroll_hibou/models/browsable_object.py @@ -137,6 +137,11 @@ class Payslips(BrowsableObject): @property def paid_amount(self): return self.dict._get_paid_amount() + + # Hibou helper + @property + def pay_periods_in_year(self): + return self.dict.get_pay_periods_in_year() # Patch over Core diff --git a/hr_payroll_hibou/models/hr_payslip.py b/hr_payroll_hibou/models/hr_payslip.py index 323bd40f..95c6a3b9 100644 --- a/hr_payroll_hibou/models/hr_payslip.py +++ b/hr_payroll_hibou/models/hr_payslip.py @@ -7,6 +7,22 @@ from .browsable_object import BrowsableObject, InputLine, WorkedDays, Payslips class HrPayslip(models.Model): _inherit = 'hr.payslip' + # From IRS Publication 15-T or logically (annually, bi-monthly) + PAY_PERIODS_IN_YEAR = { + 'annually': 1, + 'semi-annually': 2, + 'quarterly': 4, + 'bi-monthly': 6, + 'monthly': 12, + 'semi-monthly': 24, + 'bi-weekly': 26, + 'weekly': 52, + 'daily': 260, + } + + def get_pay_periods_in_year(self): + return self.PAY_PERIODS_IN_YEAR.get(self.contract_id.schedule_pay, 0) + # We need to be able to support more complexity, # namely, that different employees will be paid by different wage types as 'salary' vs 'hourly' wage_type = fields.Selection(related='contract_id.wage_type')