From 153f7087923c76a9bd72e801ff6bcc8841d35f80 Mon Sep 17 00:00:00 2001 From: Toufik Ben Jaa Date: Tue, 21 May 2019 15:19:26 +0000 Subject: [PATCH] [FIX] hr_holidays: access issue on employee's manager update - If the current user doesn't have write access to `hr.leave` or `hr.leave.allocation` and tries to modify the manager (`parent_id`) of a `hr.employee` record, an access right issue is raised. This commit fixes the issue. OPW-2000569 closes odoo/odoo#33542 Signed-off-by: Toufik Benjaa (tbe) --- addons/hr_holidays/models/hr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_holidays/models/hr.py b/addons/hr_holidays/models/hr.py index 6f024b5e325..d878f11457c 100644 --- a/addons/hr_holidays/models/hr.py +++ b/addons/hr_holidays/models/hr.py @@ -200,8 +200,8 @@ class Employee(models.Model): hr_vals['manager_id'] = values['parent_id'] if values.get('department_id') is not None: hr_vals['department_id'] = values['department_id'] - holidays = self.env['hr.leave'].search([('state', 'in', ['draft', 'confirm']), ('employee_id', 'in', self.ids)]) + holidays = self.env['hr.leave'].sudo().search([('state', 'in', ['draft', 'confirm']), ('employee_id', 'in', self.ids)]) holidays.write(hr_vals) - allocations = self.env['hr.leave.allocation'].search([('state', 'in', ['draft', 'confirm']), ('employee_id', 'in', self.ids)]) + allocations = self.env['hr.leave.allocation'].sudo().search([('state', 'in', ['draft', 'confirm']), ('employee_id', 'in', self.ids)]) allocations.write(hr_vals) return res