From 661a9986ea6f02f63ac690ac5a1c4072e1059442 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Thu, 14 Mar 2019 17:08:50 +0100 Subject: [PATCH] [IMP] hr_holiday: Don't check access rights on allocation if no employee If there are no employee set on the allocation request and if the user is a leave officer, don't check the access rights as it would lead to a traceback. --- addons/hr_holidays/models/hr_leave_allocation.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/hr_holidays/models/hr_leave_allocation.py b/addons/hr_holidays/models/hr_leave_allocation.py index da978c4ae60..a82fad4eebf 100644 --- a/addons/hr_holidays/models/hr_leave_allocation.py +++ b/addons/hr_holidays/models/hr_leave_allocation.py @@ -486,6 +486,8 @@ class HolidaysAllocation(models.Model): def _check_approval_update(self, state): """ Check if target state is achievable. """ current_employee = self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1) + if not current_employee: + return is_officer = self.env.user.has_group('hr_holidays.group_hr_holidays_user') is_manager = self.env.user.has_group('hr_holidays.group_hr_holidays_manager') for holiday in self: