[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 <oco-odoo@users.noreply.github.com>
This commit is contained in:
jbw
2021-01-15 15:12:34 +00:00
parent 864f962145
commit 044250c08b
@@ -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,