mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[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.
This commit is contained in:
20
hr_payroll_hibou/models/hr_contract.py
Normal file
20
hr_payroll_hibou/models/hr_contract.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class HrContract(models.Model):
|
||||
_inherit = 'hr.contract'
|
||||
|
||||
wage_type = fields.Selection([('monthly', 'Period Fixed Wage'), ('hourly', 'Hourly Wage')],
|
||||
default='monthly', required=True, related=False)
|
||||
|
||||
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.
|
||||
self.ensure_one()
|
||||
return self[self._get_contract_wage_field(work_type=work_type)]
|
||||
|
||||
def _get_contract_wage_field(self, work_type=None):
|
||||
if self.wage_type == 'hourly':
|
||||
return 'hourly_wage'
|
||||
return super()._get_contract_wage_field()
|
||||
Reference in New Issue
Block a user