[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 <beledouxdenis@users.noreply.github.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user