Skip to content
Permalink
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`.
  • Loading branch information...
tbe-odoo committed Apr 23, 2019
1 parent 9617e79 commit 6bad2b29e6702be68127bf0079af4ec86aa4f79b
Showing with 2 additions and 2 deletions.
  1. +2 −2 addons/hr_holidays/models/hr_leave_allocation.py
@@ -243,8 +243,8 @@ def _onchange_number_of_days_display(self):

@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 comments on commit 6bad2b2

Please sign in to comment.
You can’t perform that action at this time.