[FIX] account: fix bank_id from another company

When using module `account_invoice_extract`, it would happen that a
bank account of another company was set on the `account.move`.
This happened when the extract update was done in background via the
cron.
A check on the company of the bank account fixes the issue.

opw-2631833

closes odoo/odoo#76024

X-original-commit: 12559929a551c7f837facb8242333e9b0285950b
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: Louis Baudoux <lobaudoux@users.noreply.github.com>
This commit is contained in:
Louis Baudoux
2021-09-06 15:47:29 +00:00
parent eb2e328275
commit 5d42dfcf33
+2 -1
View File
@@ -495,7 +495,8 @@ class AccountMove(models.Model):
line.account_id = new_term_account
self._compute_bank_partner_id()
self.partner_bank_id = self.bank_partner_id.bank_ids and self.bank_partner_id.bank_ids[0]
bank_ids = self.bank_partner_id.bank_ids.filtered(lambda bank: bank.company_id is False or bank.company_id == self.company_id)
self.partner_bank_id = bank_ids and bank_ids[0]
# Find the new fiscal position.
delivery_partner_id = self._get_invoice_delivery_partner_id()