Files
suite/hr_payroll_hibou/models/hr_payslip.py
Jared Kipe 16821f85c3 [IMP] hr_payroll_hibou: Control the 'wage_type' at the HR Contract Level
This will make it possible to be more abstract with 'work_type' or 'worked days lines' and overtime.
2020-11-27 14:22:16 -08:00

28 lines
1.1 KiB
Python

# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from odoo import fields, models
class HrPayslip(models.Model):
_inherit = 'hr.payslip'
# 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')
def get_year(self):
"""
# Helper method to get the year (normalized between Odoo Versions)
:return: int year of payslip
"""
return self.date_to.year
def _get_contract_wage(self, work_type=None):
# Override if you pay differently for different work types
# In 14.0, this utilizes new computed field mechanism,
# but will still get the 'wage' field by default.
# This would be a good place to override though with a 'work type'
# based mechanism, like a minimum rate or 'rate card' implementation
return self.contract_id._get_contract_wage(work_type=work_type)