[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.
This commit is contained in:
Yannick Tivisse
2019-03-19 09:35:31 +01:00
parent adc4eb0af3
commit 661a9986ea
@@ -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: