[FIX] account: fix invoice register payment wizard

The register payment wizard for invoices is fetching a default account
for the partner in a compute, without verifying the company.
This can cause the wizard to load an bank account from another company
and block the user to finish the payment.

This commit will make sure the account loaded is from the current company.

Task id #2308032

closes odoo/odoo#57072

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
Nicolas (vin)
2020-08-21 12:30:41 +00:00
parent f20adc19d2
commit 62d0bdf5db
@@ -261,7 +261,7 @@ class AccountPaymentRegister(models.TransientModel):
def _compute_partner_bank_id(self):
''' The default partner_bank_id will be the first available on the partner. '''
for wizard in self:
available_partner_bank_accounts = wizard.partner_id.bank_ids
available_partner_bank_accounts = wizard.partner_id.bank_ids.filtered_domain([('company_id', '=', wizard.company_id.id)])
if available_partner_bank_accounts:
wizard.partner_bank_id = available_partner_bank_accounts[0]._origin
else: