[FIX] account: bank journal not showing as payment option when unvailable

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) <wan@odoo.com>
This commit is contained in:
Maruan Aguerdouh (magm)
2022-11-24 19:25:29 +01:00
parent 42859bed9c
commit c415889f78
@@ -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')