mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[FIX] hr_payroll_attendance: tests and migration fixes
This commit is contained in:
@@ -13,4 +13,4 @@ class HrContract(models.Model):
|
|||||||
for contract in self:
|
for contract in self:
|
||||||
if contract.paid_hourly_attendance:
|
if contract.paid_hourly_attendance:
|
||||||
# only allow switch, not automatic switch 'back'
|
# only allow switch, not automatic switch 'back'
|
||||||
self.wage_type = 'hourly'
|
contract.wage_type = 'hourly'
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class HrPayslip(models.Model):
|
|||||||
payslip.attendance_count = len(payslip.attendance_ids)
|
payslip.attendance_count = len(payslip.attendance_ids)
|
||||||
|
|
||||||
def _filter_worked_day_lines_values(self, worked_day_lines_values):
|
def _filter_worked_day_lines_values(self, worked_day_lines_values):
|
||||||
|
worked_day_lines_values = super()._filter_worked_day_lines_values(worked_day_lines_values)
|
||||||
if self.contract_id.paid_hourly_attendance:
|
if self.contract_id.paid_hourly_attendance:
|
||||||
original_work_type = self.env.ref('hr_work_entry.work_entry_type_attendance', raise_if_not_found=False)
|
original_work_type = self.env.ref('hr_work_entry.work_entry_type_attendance', raise_if_not_found=False)
|
||||||
if original_work_type:
|
if original_work_type:
|
||||||
@@ -42,7 +43,7 @@ class HrPayslip(models.Model):
|
|||||||
attendance_type = self.struct_id.type_id.default_work_entry_type_id
|
attendance_type = self.struct_id.type_id.default_work_entry_type_id
|
||||||
if not attendance_type:
|
if not attendance_type:
|
||||||
# return early, include the "work calendar lines"
|
# return early, include the "work calendar lines"
|
||||||
return res
|
return work_data
|
||||||
work_data = self._pre_aggregate_attendance_data(work_data, attendance_type)
|
work_data = self._pre_aggregate_attendance_data(work_data, attendance_type)
|
||||||
return work_data
|
return work_data
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,14 @@ from odoo.addons.hr_payroll_hibou.tests import common
|
|||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
class TestUsPayslip(common.TestPayslip):
|
class TestAttendancePayslip(common.TestPayslip):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
|
self.work_type = self.env.ref('hr_attendance_work_entry.work_input_attendance')
|
||||||
|
self.overtime_rules = self.work_type.overtime_type_id
|
||||||
|
self.overtime_rules.hours_per_day = 0.0
|
||||||
|
self.overtime_rules.multiplier = 1.5
|
||||||
self.test_hourly_wage = 21.5
|
self.test_hourly_wage = 21.5
|
||||||
self.employee = self._createEmployee()
|
self.employee = self._createEmployee()
|
||||||
self.contract = self._createContract(self.employee,
|
self.contract = self._createContract(self.employee,
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<data>
|
<data>
|
||||||
<xpath expr="//field[@name='worked_hours']" position="after">
|
<xpath expr="//field[@name='worked_hours']" position="after">
|
||||||
<field name="payslip_id"/>
|
<field name="payslip_id"
|
||||||
|
domain="[('employee_id', '=', employee_id)]" />
|
||||||
</xpath>
|
</xpath>
|
||||||
</data>
|
</data>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user