From b041d377d15b86e3c8061ff10467a7a4036bbd70 Mon Sep 17 00:00:00 2001 From: Nam Dao Date: Fri, 19 Aug 2022 02:23:47 +0000 Subject: [PATCH] [FIX] hr_expense: User with account permission but no employee permission can't register payment - A user has accounting permission but no employee permission, when that user register payment in spending it gives an error that does not have access to the bank_account_id field - This commit allows the user to read the bank_account_id field when register payment Original PR: odoo/odoo#98432 closes odoo/odoo#98485 X-original-commit: 35e07de192dfeba0979170ba8421e4a61c5a483b Signed-off-by: Kevin Baptiste --- addons/hr_expense/models/hr_expense.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_expense/models/hr_expense.py b/addons/hr_expense/models/hr_expense.py index bb36de2b79d..1116b9ad172 100644 --- a/addons/hr_expense/models/hr_expense.py +++ b/addons/hr_expense/models/hr_expense.py @@ -1222,7 +1222,7 @@ class HrExpenseSheet(models.Model): 'context': { 'active_model': 'account.move', 'active_ids': self.account_move_id.ids, - 'default_partner_bank_id': self.employee_id.bank_account_id.id, + 'default_partner_bank_id': self.employee_id.sudo().bank_account_id.id, }, 'target': 'new', 'type': 'ir.actions.act_window',