From c415889f7809e2b8e29c92a8764c8486c301d24e Mon Sep 17 00:00:00 2001 From: "Maruan Aguerdouh (magm)" Date: Thu, 3 Nov 2022 13:07:25 +0000 Subject: [PATCH] [FIX] account: bank journal not showing as payment option when unvailable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Steps to reproduce: -Go to Journals > Bank journal > Remove all Incoming Payments -Try to pay for an invoice -The Bank journal will still appear Issue: Bank journal should not be an option if it doesn't have Incoming Payments. Solution: We need to add the proper filter for journals in the default_domain in order to not get the bank journal when it is not available. This bug affects all versions from 15.2 until 16. opw-3027346 closes odoo/odoo#106471 X-original-commit: 119676029b929512179a337f0f3b70837a5c2b37 Signed-off-by: William André (wan) --- addons/account/wizard/account_payment_register.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/account/wizard/account_payment_register.py b/addons/account/wizard/account_payment_register.py index 28855b73dd5..95ebd2a6490 100644 --- a/addons/account/wizard/account_payment_register.py +++ b/addons/account/wizard/account_payment_register.py @@ -171,6 +171,7 @@ class AccountPaymentRegister(models.TransientModel): default_domain = [ ('type', 'in', ('bank', 'cash')), ('company_id', '=', batch_result['lines'].company_id.id), + ('id', 'in', self.available_journal_ids.ids) ] if partner_bank_id: @@ -399,6 +400,7 @@ class AccountPaymentRegister(models.TransientModel): wizard.journal_id = self.env['account.journal'].search([ ('type', 'in', ('bank', 'cash')), ('company_id', '=', wizard.company_id.id), + ('id', 'in', self.available_journal_ids.ids) ], limit=1) @api.depends('can_edit_wizard', 'journal_id')