[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`.
This commit is contained in:
committed by
Yannick Tivisse
parent
492764c559
commit
c0bb910dff
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user