[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) <tbe@odoo.com>
This commit is contained in:
Toufik Ben Jaa
2019-05-21 15:19:26 +00:00
parent cdd5b78c63
commit 153f708792
+2 -2
View File
@@ -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