From 8b5f613cc0927b030a0e37ae694a8f14b4b45797 Mon Sep 17 00:00:00 2001 From: "Guillaume (guva)" Date: Mon, 24 Jan 2022 14:35:27 +0000 Subject: [PATCH] [FIX] account: compute the journal_id for payment register wizard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce: - Create an invoice and confirm it - In Accounting Dashboard, on the Customer Invoices card, click on 'Unpaid Invoices' - Select the invoice with the checkbox - Click on button 'Register Payment' Issue: - The journal_id is not set by default Before this commit, the default fields inherited 'journal_id', if it's not the good one, we delete it in order to compute it.. opw-2729754 closes odoo/odoo#83770 X-original-commit: 9e2f96598f3d62b501e894eab7151af8390937e1 Signed-off-by: William André (wan) Signed-off-by: Guillaume Vanleynseele --- addons/account/wizard/account_payment_register.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/account/wizard/account_payment_register.py b/addons/account/wizard/account_payment_register.py index 642ac8203a8..4c76fe37efd 100644 --- a/addons/account/wizard/account_payment_register.py +++ b/addons/account/wizard/account_payment_register.py @@ -464,6 +464,11 @@ class AccountPaymentRegister(models.TransientModel): "The register payment wizard should only be called on account.move or account.move.line records." )) + if 'journal_id' in res and not self.env['account.journal'].browse(res['journal_id'])\ + .filtered_domain([('company_id', '=', lines.company_id.id), ('type', 'in', ('bank', 'cash'))]): + # default can be inherited from the list view, should be computed instead + del res['journal_id'] + # Keep lines having a residual amount to pay. available_lines = self.env['account.move.line'] for line in lines: