From 044250c08bf296a18a984ace7cd147ea730cc87b Mon Sep 17 00:00:00 2001 From: jbw Date: Thu, 14 Jan 2021 15:26:11 +0000 Subject: [PATCH] [FIX] account: fix available payment methods for payments batch Previously, in batch payments wizard, available payment methods where always set to wizard.journal_id.outbound_payment_method_ids when the batch length was > 1. Event when the payment type was inbound and not outbound. closes odoo/odoo#64624 Task: 2439250 X-original-commit: 603dbbe7a784c23b87682655963e82a42137d84c Related: odoo/enterprise#15791 Signed-off-by: oco-odoo --- addons/account/wizard/account_payment_register.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/account/wizard/account_payment_register.py b/addons/account/wizard/account_payment_register.py index 279e880489f..c8e86c1d880 100644 --- a/addons/account/wizard/account_payment_register.py +++ b/addons/account/wizard/account_payment_register.py @@ -195,11 +195,12 @@ class AccountPaymentRegister(models.TransientModel): ''' Load initial values from the account.moves passed through the context. ''' for wizard in self: batches = wizard._get_batches() + batch_result = batches[0] + wizard_values_from_batch = wizard._get_wizard_values_from_batch(batch_result) if len(batches) == 1: # == Single batch to be mounted on the view == - batch_result = batches[0] - wizard.update(wizard._get_wizard_values_from_batch(batch_result)) + wizard.update(wizard_values_from_batch) wizard.can_edit_wizard = True wizard.can_group_payments = len(batch_result['lines']) != 1 @@ -209,7 +210,7 @@ class AccountPaymentRegister(models.TransientModel): 'company_id': batches[0]['lines'][0].company_id.id, 'partner_id': False, 'partner_type': False, - 'payment_type': False, + 'payment_type': wizard_values_from_batch['payment_type'], 'source_currency_id': False, 'source_amount': False, 'source_amount_currency': False,