Skip to content
Snippets Groups Projects
Commit 3f2bb3df authored by Nam Dao's avatar Nam Dao
Browse files

[FIX] hr_expense: User with account permission but no employee permission can't create payment


- A user has accounting permission but no employee permission, when that user creates a 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 creating a payment

closes odoo/odoo#96607

X-original-commit: 8045780c
Signed-off-by: default avatarKevin Baptiste <kba@odoo.com>
parent a8d5787c
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ class AccountPaymentRegister(models.TransientModel):
res = super()._get_line_batch_key(line)
expense_sheet = self.env['hr.expense.sheet'].search([('payment_mode', '=', 'own_account'), ('account_move_id', 'in', line.move_id.ids)])
if expense_sheet and not line.move_id.partner_bank_id:
res['partner_bank_id'] = expense_sheet.employee_id.bank_account_id.id or line.partner_id.bank_ids and line.partner_id.bank_ids.ids[0]
res['partner_bank_id'] = expense_sheet.employee_id.sudo().bank_account_id.id or line.partner_id.bank_ids and line.partner_id.bank_ids.ids[0]
return res
def _init_payments(self, to_process, edit_mode=False):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment