[IMP] hr_payroll_hibou: add pay period to payslip

This commit is contained in:
Jared Kipe
2022-04-28 19:22:17 +00:00
parent 2d2f42caf9
commit 4efa002b0e
3 changed files with 22 additions and 1 deletions

View File

@@ -3,7 +3,7 @@
{
'name': 'Hibou Payroll',
'author': 'Hibou Corp. <hello@hibou.io>',
'version': '13.0.2.0.0',
'version': '13.0.2.1.0',
'category': 'Payroll Localization',
'depends': [
'hr_payroll',

View File

@@ -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

View File

@@ -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')