[FIX] hr_payroll_attendance: Unlink behavior on attendances and remove "Work Calendar" work lines.

This commit is contained in:
Jared Kipe
2020-07-10 14:31:14 -07:00
parent cf399eb6c3
commit c07254ef2b
6 changed files with 80 additions and 40 deletions

View File

@@ -120,3 +120,20 @@ class TestUsPayslip(common.TransactionCase):
# (80 * 21.50) + (47.37 * 21.50 * 1.5) = 3247.6825
cats = self._getCategories()
self.assertAlmostEqual(cats['BASIC'], 3247.68, 2)
# ensure unlink behavior.
self.payslip.attendance_ids = self.env['hr.attendance'].browse()
self.payslip.state = 'draft'
self.payslip.flush()
self.payslip._onchange_employee()
self.payslip.compute_sheet()
cats = self._getCategories()
self.assertAlmostEqual(cats['BASIC'], 3247.68, 2)
self.payslip.write({'attendance_ids': [(5, 0, 0)]})
self.payslip.state = 'draft'
self.payslip.flush()
self.payslip._onchange_employee()
self.payslip.compute_sheet()
cats = self._getCategories()
self.assertAlmostEqual(cats['BASIC'], 3247.68, 2)