[FIX] hr_holidays_attendance: allow non HR officer user to refuse leaves
When refusing a leave, we are deleting the associated overtime if any so it can be used again by the employee. However, we need HR Officer rights to access overtime field. The sudo() should be used before we try to read the field to avoid errors in case the manager of the employee does not have HR rights. closes odoo/odoo#80945 X-original-commit: 1ffbcf9787e5efe00d49f18baba0144f631ada51 Signed-off-by: Kevin Baptiste <kba@odoo.com> Signed-off-by: Alex Thuyls (alt) <alt@odoo.com>
This commit is contained in:
@@ -77,5 +77,5 @@ class HRLeave(models.Model):
|
||||
|
||||
def action_refuse(self):
|
||||
res = super().action_refuse()
|
||||
self.overtime_id.sudo().unlink()
|
||||
self.sudo().overtime_id.unlink()
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user