[FIX] hr_payroll_hibou: patch upstream field from Int to Float

This commit is contained in:
Jared Kipe
2022-03-21 17:43:38 +00:00
parent 314afdf63d
commit 6e4bb1bc97
2 changed files with 13 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
{
'name': 'Hibou Payroll',
'author': 'Hibou Corp. <hello@hibou.io>',
'version': '15.0.2.0.0',
'version': '15.0.2.1.0',
'category': 'Payroll Localization',
'depends': [
'hr_payroll',
@@ -16,6 +16,7 @@ Hibou Payroll
Base module for fixing specific qwerks or assumptions in the way Payroll Odoo Enterprise Edition behaves.
2.1.0 : fixes precision error in upstream by changing `normal_wage` field from Integer to Float
""",
'data': [
'security/ir.model.access.csv',

View File

@@ -1,15 +1,25 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from odoo import fields, models
from odoo import api, fields, models
class HrPayslip(models.Model):
_inherit = 'hr.payslip'
# normal_wage is an integer field, but that lacks precision.
normal_wage = fields.Float(compute='_compute_normal_wage', store=True)
# 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')
@api.depends('contract_id')
def _compute_normal_wage(self):
with_contract = self.filtered('contract_id')
# fixes bug in original computation if the size of the recordset is >1
(self - with_contract).update({'normal_wage': 0.0})
for payslip in with_contract:
payslip.normal_wage = payslip._get_contract_wage()
def get_year(self):
"""
# Helper method to get the year (normalized between Odoo Versions)