Skip to content
Permalink
Browse files

[FIX] hr_holidays: allow to create leaves with no validation

- The creation of leaves using "no validation" are not possible
  if the `SUPERUSER` is not in the "Holidays / Team Leader" because
  the validation is made using `sudo`.

OPW-1951316
  • Loading branch information...
tbe-odoo committed Mar 19, 2019
1 parent 23cb7a9 commit c108fe077a56a47c6127b535b7973d6a9229681d
Showing with 4 additions and 1 deletion.
  1. +4 −1 addons/hr_holidays/models/hr_leave.py
@@ -9,7 +9,7 @@
from datetime import datetime, time
from pytz import timezone, UTC

from odoo import api, fields, models
from odoo import api, fields, models, SUPERUSER_ID
from odoo.addons.resource.models.resource import float_to_time, HOURS_PER_DAY
from odoo.exceptions import AccessError, UserError, ValidationError
from odoo.tools import float_compare
@@ -730,6 +730,9 @@ def action_refuse(self):

def _check_approval_update(self, state):
""" Check if target state is achievable. """
if self.env.user.id == SUPERUSER_ID:
return

current_employee = self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1)
is_team_leader = self.env.user.has_group('hr_holidays.group_hr_holidays_team_leader')
is_officer = self.env.user.has_group('hr_holidays.group_hr_holidays_user')

0 comments on commit c108fe0

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