mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[FIX] hr_payroll_timesheet: error and duplicate count on initial form create
This commit is contained in:
@@ -39,6 +39,7 @@ class HrPayslip(models.Model):
|
||||
('employee_id', '=', self.employee_id.id),
|
||||
('date', '<=', self.date_to),
|
||||
('payslip_id', '=', False),
|
||||
('id', 'not in', timesheet_to_keep.ids),
|
||||
])
|
||||
self.update({'timesheet_ids': [(6, 0, timesheet_to_keep.ids)]})
|
||||
|
||||
@@ -87,7 +88,7 @@ class HrPayslip(models.Model):
|
||||
|
||||
def _pre_aggregate_timesheet_data(self, default_workentrytype):
|
||||
worked_ts = defaultdict(list)
|
||||
for ts in self.timesheet_ids.sorted('id'):
|
||||
for ts in self.timesheet_ids.sorted('date'):
|
||||
if ts.unit_amount:
|
||||
ts_iso = ts.date.isocalendar()
|
||||
timesheet_type = ts.work_type_id or default_workentrytype
|
||||
|
||||
@@ -86,7 +86,11 @@ class TestPayslipTimesheet(common.TransactionCase):
|
||||
'payslip_id': self.payslip_dummy.id,
|
||||
})
|
||||
|
||||
self.payslip._onchange_employee()
|
||||
payslip_form = common.Form(self.env['hr.payslip'])
|
||||
payslip_form.date_from = '2018-01-01'
|
||||
payslip_form.date_to = '2018-01-31'
|
||||
payslip_form.employee_id = self.employee
|
||||
self.payslip = payslip_form.save()
|
||||
self.assertTrue(self.payslip.contract_id, 'No auto-discovered contract!')
|
||||
wage = self.test_hourly_wage
|
||||
self.payslip.compute_sheet()
|
||||
|
||||
Reference in New Issue
Block a user