From 9a48d00706486cf4c205dceea0a0100e9af92f30 Mon Sep 17 00:00:00 2001 From: "Harsh Bhatt (habh)" Date: Thu, 25 May 2023 05:36:07 +0000 Subject: [PATCH] [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 Signed-off-by: habh-odoo --- addons/account/models/account_bank_statement_line.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/account/models/account_bank_statement_line.py b/addons/account/models/account_bank_statement_line.py index f7a7a84b83c..fd46b5afb3f 100644 --- a/addons/account/models/account_bank_statement_line.py +++ b/addons/account/models/account_bank_statement_line.py @@ -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