[IMP] account_financial_report: avoid crash if data structure changes in the future

This commit is contained in:
Alexis de Lattre
2024-10-24 16:08:24 +02:00
committed by chaule97
parent 2dad961ebb
commit 3273d27e6c

View File

@@ -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: