[FIX] account: fix traceback on opening bank statement

When user changes the default_account_id on a journal and tries to open a
statement line, they will get the traceback.

Note: This is reproduceable by using account_accountant only.

Steps to reproduce:
1) open configuration of bank journal
2) change default_account_id (bank account) from bank to cash
3) open bank statement
4) open any statement line
5) by following these steps, traceback occurs.

This commit will prevent the above traceback.

sentry - 4059226840

closes odoo/odoo#125375

X-original-commit: 12410133d548f3c9ff44fd548bbf664f008a3ae3
Related: odoo/enterprise#42685
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: habh-odoo <habh@odoo.com>
This commit is contained in:
Harsh Bhatt (habh)
2023-06-16 14:59:42 +02:00
parent dd013e6934
commit 9a48d00706
@@ -630,6 +630,9 @@ class AccountBankStatementLine(models.Model):
suspense_lines += line
else:
other_lines += line
if not liquidity_lines:
liquidity_lines = self.move_id.line_ids.filtered(lambda l: l.account_id.account_type == 'asset_cash')
other_lines -= liquidity_lines
return liquidity_lines, suspense_lines, other_lines
# SYNCHRONIZATION account.bank.statement.line <-> account.move