[FIX] account: compute the journal_id for payment register wizard

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) <wan@odoo.com>
Signed-off-by: Guillaume Vanleynseele <guva@odoo.com>
This commit is contained in:
Guillaume (guva)
2022-02-01 15:32:29 +00:00
parent b89f630d73
commit 8b5f613cc0
@@ -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: