diff --git a/addons/hr_holidays/models/hr_leave_allocation.py b/addons/hr_holidays/models/hr_leave_allocation.py index f44d73d6fc0..53b62f2acea 100644 --- a/addons/hr_holidays/models/hr_leave_allocation.py +++ b/addons/hr_holidays/models/hr_leave_allocation.py @@ -256,13 +256,14 @@ class HolidaysAllocation(models.Model): @api.depends('holiday_type') def _compute_from_holiday_type(self): + default_employee_ids = self.env['hr.employee'].browse(self.env.context.get('default_employee_id')) or self.env.user.employee_id for allocation in self: if allocation.holiday_type == 'employee': if not allocation.employee_ids: allocation.employee_ids = self.env.user.employee_id allocation.mode_company_id = False allocation.category_id = False - if allocation.holiday_type == 'company': + elif allocation.holiday_type == 'company': allocation.employee_ids = False if not allocation.mode_company_id: allocation.mode_company_id = self.env.company @@ -275,8 +276,7 @@ class HolidaysAllocation(models.Model): allocation.employee_ids = False allocation.mode_company_id = False else: - employee_ids = self.env.context.get('default_employee_id', self.env.user.employee_id) - allocation.employee_ids = [employee_ids] if isinstance(employee_ids, int) else employee_ids + allocation.employee_ids = default_employee_ids @api.depends('holiday_type', 'employee_id') def _compute_department_id(self): diff --git a/addons/hr_holidays_attendance/models/res_users.py b/addons/hr_holidays_attendance/models/res_users.py index 6fb8738bb22..0a0f8a15c21 100644 --- a/addons/hr_holidays_attendance/models/res_users.py +++ b/addons/hr_holidays_attendance/models/res_users.py @@ -18,7 +18,6 @@ class ResUsers(models.Model): def _compute_request_overtime(self): is_holiday_user = self.env.user.has_group('hr_holidays.group_hr_holidays_user') time_off_types = self.env['hr.leave.type'].search_count([ - ('has_valid_allocation', '=', True), ('requires_allocation', '=', 'yes'), ('employee_requests', '=', 'yes'), ('overtime_deductible', '=', True)