[FIX] hr_holidays: employee onchange when no employee set

When changing the employee to None in an allocation,
this onchange raised an error because it attempted
to set an employee browser record (empty but still)
in a department many2one.

- Create a new leave allocation
- Try to change the field Mode (holiday_type) from "By Employee" to "By Employee Tag"

Fixes #23345
opw-1820069
This commit is contained in:
Denis Ledoux
2018-03-07 15:52:16 +01:00
parent b7b8634575
commit 43f0cbcc86
+1 -1
View File
@@ -216,7 +216,7 @@ class Holidays(models.Model):
@api.onchange('employee_id')
def _onchange_employee_id(self):
self.manager_id = self.employee_id and self.employee_id.parent_id
self.department_id = self.employee_id and self.employee_id.department_id
self.department_id = self.employee_id.department_id
@api.multi
@api.depends('number_of_days_temp', 'type')