From 88b55a658ea444447e4a285a8c8f3bfb4cb6cdd3 Mon Sep 17 00:00:00 2001 From: Rob Coekaerts Date: Wed, 21 Jun 2023 09:49:11 +0200 Subject: [PATCH] [FIX] hr_work_entry_holidays: remove faulty test Removed this test because 1. What it was testing doesn't make sense, namely the behaviour of resource leave creation when you explicitly set the resource calendar id of the employee to a different one than the one on the current running contract, which is an inconsistent state that generates warning messages when you try to do so. 2. The test wasn't testing that correctly because it was only testing whether two resource leaves were created, but not whether they were actually created in the two different calendars, which was not the case. Part-of: odoo/odoo#119317 --- addons/hr_work_entry_holidays/tests/test_leave.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/addons/hr_work_entry_holidays/tests/test_leave.py b/addons/hr_work_entry_holidays/tests/test_leave.py index 4652bbf6da8..f5895e2eb70 100644 --- a/addons/hr_work_entry_holidays/tests/test_leave.py +++ b/addons/hr_work_entry_holidays/tests/test_leave.py @@ -30,20 +30,6 @@ class TestWorkEntryLeave(TestWorkEntryHolidaysBase): self.assertEqual(len(resource_leave), 1, "it should have created only one resource leave") self.assertEqual(resource_leave.work_entry_type_id, self.leave_type.work_entry_type_id, "it should have the corresponding work_entry type") - def test_resource_leave_different_calendars(self): - other_calendar = self.env['resource.calendar'].create({'name': 'New calendar'}) - contract = self.richard_emp.contract_ids[0] - contract.resource_calendar_id = other_calendar - contract.state = 'open' # this set richard's calendar to New calendar - - # set another calendar - self.richard_emp.resource_calendar_id = self.env['resource.calendar'].create({'name': 'Other calendar'}) - - leave = self.create_leave() - resource_leave = leave._create_resource_leave() - self.assertEqual(len(resource_leave), 2, "it should have created one resource leave per calendar") - self.assertEqual(resource_leave.mapped('work_entry_type_id'), self.leave_type.work_entry_type_id, "they should have the corresponding work_entry type") - def test_create_mark_conflicting_work_entries(self): work_entry = self.create_work_entry(datetime(2019, 10, 10, 9, 0), datetime(2019, 10, 10, 12, 0)) self.assertNotEqual(work_entry.state, 'conflict', "It should not be conflicting")