[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 closes odoo/odoo#31952 Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
This commit is contained in:
@@ -9,7 +9,7 @@ import math
|
||||
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 @@ class HolidaysRequest(models.Model):
|
||||
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user