From 30e7a64cbdb9884f847dfb6c39a30ab651e650d7 Mon Sep 17 00:00:00 2001 From: Toufik Ben Jaa Date: Tue, 23 Apr 2019 15:22:16 +0000 Subject: [PATCH] [FIX] hr_holidays: fix logic of a onchange on leave allocation - When changing the `holiday_type` of a leave allocation while having an employee set and if this `holiday_type` has as its value `employee` the field `employee_id` is set to False. This is not the intended behavior. We want the field `employee_id` to be filled if the `holiday_type` is set to `employee`. closes odoo/odoo#32886 Signed-off-by: Denis Ledoux --- addons/hr_holidays/models/hr_leave_allocation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_holidays/models/hr_leave_allocation.py b/addons/hr_holidays/models/hr_leave_allocation.py index b92ca28f856..1ef1a13b3a4 100644 --- a/addons/hr_holidays/models/hr_leave_allocation.py +++ b/addons/hr_holidays/models/hr_leave_allocation.py @@ -243,8 +243,8 @@ class HolidaysAllocation(models.Model): @api.onchange('holiday_type') def _onchange_type(self): - if self.holiday_type == 'employee' and not self.employee_id: - if self.env.user.employee_ids: + if self.holiday_type == 'employee': + if not self.employee_id and self.env.user.employee_ids: self.employee_id = self.env.user.employee_ids[0] elif self.holiday_type == 'department': if self.env.user.employee_ids: