Skip to content
Permalink
Browse files

[FIX] hr_leave: 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`.
  • Loading branch information...
LucasLefevre committed Mar 15, 2019
1 parent e6d5392 commit 3b242c9b669adb3cd0d4bd371435c83d1488c79d
Showing with 2 additions and 0 deletions.
  1. +2 −0 addons/hr_holidays/models/hr_leave.py
@@ -759,6 +759,8 @@ def _check_approval_update(self, state):
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')

0 comments on commit 3b242c9

Please sign in to comment.
You can’t perform that action at this time.