diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 0977f3729b4..eb7b44b8a3d 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -182,6 +182,13 @@ class hr_holidays(osv.osv): } return result + def onchange_employee(self, cr, uid, ids, employee_id): + result = {'value': {'department_id': False}} + if employee_id: + employee = self.pool.get('hr.employee').browse(cr, uid, employee_id) + result['value'] = {'department_id': employee.department_id.id} + return result + # TODO: can be improved using resource calendar method def _get_number_of_days(self, date_from, date_to): """Returns a float equals to the timedelta between two dates given as string.""" diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index 1808e216906..ea9a7fe3a66 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -115,7 +115,7 @@ - +