From 3273d27e6c611094de190097acb1c094c6366080 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 24 Oct 2024 16:08:24 +0200 Subject: [PATCH] [IMP] account_financial_report: avoid crash if data structure changes in the future --- account_financial_report/report/trial_balance.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/account_financial_report/report/trial_balance.py b/account_financial_report/report/trial_balance.py index 95f19a07..d06e7a64 100644 --- a/account_financial_report/report/trial_balance.py +++ b/account_financial_report/report/trial_balance.py @@ -313,7 +313,10 @@ class TrialBalanceReport(models.AbstractModel): for acc_id, total_data in total_amount.items(): tmp_list = sorted( total_data.items(), - key=lambda x: isinstance(x[1], dict) and x[1]["partner_name"] or x[0], + key=lambda x: isinstance(x[0], int) + and isinstance(x[1], dict) + and x[1]["partner_name"] + or x[0], ) total_amount[acc_id] = {} for key, value in tmp_list: