From 2dbce5e6ff851ecc9936bccb40ec42663f0e8bb4 Mon Sep 17 00:00:00 2001 From: Nans Lefebvre Date: Thu, 7 Mar 2019 09:19:36 +0000 Subject: [PATCH] [FIX] hr_holidays: handle all holiday types in onchange The holiday_type can be 'employee', 'company', 'department' or 'category'. However in the onchange of holiday_type, for some reason nothing was done in the case of the 'company' value. As a result, the default 'employee' would set the employee_id, but then changing the type to company would not remove the employee_id. It follows that the lucky employee would get two allocations instead of one. opw 1938498 closes odoo/odoo#31656 Signed-off-by: Nans Lefebvre (len) --- addons/hr_holidays/models/hr_leave_allocation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_holidays/models/hr_leave_allocation.py b/addons/hr_holidays/models/hr_leave_allocation.py index a6081d2d566..c887ab0ee43 100644 --- a/addons/hr_holidays/models/hr_leave_allocation.py +++ b/addons/hr_holidays/models/hr_leave_allocation.py @@ -251,7 +251,7 @@ class HolidaysAllocation(models.Model): if self.env.user.employee_ids: self.department_id = self.department_id or self.env.user.employee_ids[0].department_id self.employee_id = None - elif self.holiday_type == 'category': + else: self.employee_id = None self.department_id = None