[FIX] account: Use only partner bank accounts of the payment company

closes odoo/odoo#65418

X-original-commit: 8ff165025e18a8d49a5666caac1747046ce87b6e
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
Laurent Smet
2021-02-02 14:05:10 +00:00
parent 69aae687fc
commit 66a98f8ed8
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -319,7 +319,7 @@ class AccountPayment(models.Model):
def _compute_partner_bank_id(self):
''' The default partner_bank_id will be the first available on the partner. '''
for pay in self:
available_partner_bank_accounts = pay.partner_id.bank_ids
available_partner_bank_accounts = pay.partner_id.bank_ids.filtered(lambda x: x.company_id in (False, pay.company_id))
if available_partner_bank_accounts:
pay.partner_bank_id = available_partner_bank_accounts[0]._origin
else:
@@ -262,7 +262,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.filtered_domain([('company_id', '=', wizard.company_id.id)])
available_partner_bank_accounts = wizard.partner_id.bank_ids.filtered(lambda x: x.company_id in (False, wizard.company_id))
if available_partner_bank_accounts:
wizard.partner_bank_id = available_partner_bank_accounts[0]._origin
else: