Skip to content

Commit

Permalink
[IMP] hr_holiday: Don't check access rights on allocation if no employee
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tivisse committed Mar 14, 2019
1 parent c8266ba commit 1369e21
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions addons/hr_holidays/models/hr_leave_allocation.py
Expand Up @@ -486,6 +486,8 @@ def action_refuse(self):
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:
Expand Down

0 comments on commit 1369e21

Please sign in to comment.