mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[IMP] hr_payroll_hibou: pay periods out of l10n_us_hr_payroll
This commit is contained in:
@@ -138,6 +138,10 @@ class Payslips(BrowsableObject):
|
|||||||
def paid_amount(self):
|
def paid_amount(self):
|
||||||
return self.dict._get_paid_amount()
|
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
|
# Patch over Core
|
||||||
browsable_object.BrowsableObject.__init__ = BrowsableObject.__init__
|
browsable_object.BrowsableObject.__init__ = BrowsableObject.__init__
|
||||||
@@ -149,3 +153,4 @@ browsable_object.WorkedDays.sum = WorkedDays.sum
|
|||||||
browsable_object.Payslips._compile_browsable_query = Payslips._compile_browsable_query
|
browsable_object.Payslips._compile_browsable_query = Payslips._compile_browsable_query
|
||||||
browsable_object.Payslips.sum = Payslips.sum
|
browsable_object.Payslips.sum = Payslips.sum
|
||||||
browsable_object.Payslips.sum_category = Payslips.sum_category
|
browsable_object.Payslips.sum_category = Payslips.sum_category
|
||||||
|
browsable_object.Payslips.pay_periods_in_year = Payslips.pay_periods_in_year
|
||||||
|
|||||||
@@ -6,6 +6,19 @@ from odoo import api, fields, models
|
|||||||
class HrPayslip(models.Model):
|
class HrPayslip(models.Model):
|
||||||
_inherit = 'hr.payslip'
|
_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,
|
||||||
|
}
|
||||||
|
|
||||||
# normal_wage is an integer field, but that lacks precision.
|
# normal_wage is an integer field, but that lacks precision.
|
||||||
normal_wage = fields.Float(compute='_compute_normal_wage', store=True)
|
normal_wage = fields.Float(compute='_compute_normal_wage', store=True)
|
||||||
# We need to be able to support more complexity,
|
# We need to be able to support more complexity,
|
||||||
@@ -35,3 +48,6 @@ class HrPayslip(models.Model):
|
|||||||
# This would be a good place to override though with a 'work type'
|
# This would be a good place to override though with a 'work type'
|
||||||
# based mechanism, like a minimum rate or 'rate card' implementation
|
# based mechanism, like a minimum rate or 'rate card' implementation
|
||||||
return self.contract_id._get_contract_wage(work_type=work_type)
|
return self.contract_id._get_contract_wage(work_type=work_type)
|
||||||
|
|
||||||
|
def get_pay_periods_in_year(self):
|
||||||
|
return self.PAY_PERIODS_IN_YEAR.get(self.contract_id.schedule_pay, 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user