From c0bb910dff920ebb05f52b3b1da12f07e5846f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Lef=C3=A8vre?= Date: Fri, 15 Mar 2019 15:23:14 +0100 Subject: [PATCH] [FIX] hr_holidays: Skip validation rights if no validation If validation type is set to `no_validation`, checking if a target state is achievalbe should bypass normal checks for the user's own leaves. Otherwise, ir.rule raises an AccessError as the user doesn't normally have the rights for leave in state `validate`. --- addons/hr_holidays/models/hr_leave.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/hr_holidays/models/hr_leave.py b/addons/hr_holidays/models/hr_leave.py index 4a9bc4c03a2..7159f7feb8d 100644 --- a/addons/hr_holidays/models/hr_leave.py +++ b/addons/hr_holidays/models/hr_leave.py @@ -758,6 +758,8 @@ class HolidaysRequest(models.Model): if holiday.employee_id != current_employee: raise UserError(_('Only a Leave Manager can reset other people leaves.')) else: + if val_type == 'no_validation' and current_employee == holiday.employee_id: + continue # use ir.rule based first access check: department, members, ... (see security.xml) holiday.check_access_rule('write')