Skip to content
Snippets Groups Projects
Commit f22eb970 authored by alt-odoo's avatar alt-odoo
Browse files

[FIX] account_bank_statement_import: correct fill in of bank account


When importing bank statements, we are filling in automatically the bank account
id if an existing record matching the number is found. However, we should restrict
the search to retrieve only bank accounts belonging to the current company,
otherwise it will create a multi-company inconsistency.

closes odoo/odoo#75769

Signed-off-by: default avatarOlivier Colson <oco@odoo.com>
parent a7195c8c
No related branches found
No related tags found
No related merge requests found
......@@ -192,7 +192,8 @@ class AccountBankStatementImport(models.TransientModel):
# reconciliation process will be linked to the bank when the statement is closed.
identifying_string = line_vals.get('account_number')
if identifying_string:
partner_bank = self.env['res.partner.bank'].search([('acc_number', '=', identifying_string)], limit=1)
partner_bank = self.env['res.partner.bank']\
.search([('acc_number', '=', identifying_string), ('company_id', 'in', (False, journal.company_id.id))], limit=1)
if partner_bank:
line_vals['bank_account_id'] = partner_bank.id
line_vals['partner_id'] = partner_bank.partner_id.id
......
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