Skip to content
Snippets Groups Projects
Commit 30e7a64c authored by Toufik Ben Jaa's avatar Toufik Ben Jaa
Browse files

[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: default avatarDenis Ledoux <beledouxdenis@users.noreply.github.com>
parent 9617e79e
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment