[FIX] hr_expense: correctly set address_id for restricted user
New rights were applied on hr.employee with this commit https://github.com/odoo/odoo/commit/2d777d5ade94f4a80862608e2807660f289d9923 Since, users with limited rights would see a read error when submitting an expense to manager. Indeed, when clicking on "SUBMIT TO MANAGER", it opens the view form for 'hr.expense.sheet' that trigger an onchange on employee_id to set the employee's private address to the expense. Since restricted users can't read that field, the rpc call to that onchange was throwing an error resulting in: 1. Showing an read error when entering form view that user could close to save anyway. 2. The hr.expense.sheet address would not be set as it should have Now, we give sudo rights to read that field during the onchange OPW-815786
This commit is contained in:
committed by
Goffin Simon
parent
8876b8b3db
commit
b730de1978
@@ -512,7 +512,7 @@ class HrExpenseSheet(models.Model):
|
||||
|
||||
@api.onchange('employee_id')
|
||||
def _onchange_employee_id(self):
|
||||
self.address_id = self.employee_id.address_home_id
|
||||
self.address_id = self.employee_id.sudo().address_home_id
|
||||
self.department_id = self.employee_id.department_id
|
||||
|
||||
@api.one
|
||||
|
||||
Reference in New Issue
Block a user