Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions account_financial_report/report/trial_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,16 @@ def _compute_partner_amount(
total_amount, tb, acc_id, prt_id, foreign_currency
)
# sort on partner_name
# total_amount is a dictionary by account id that contains direct totalized
# values for that account (credit, debit, balance...), but also other integer
# keys that represents partner ids with the detail of each of them, and one
# of the partner id keys is 0 for those with no partner
for acc_id, total_data in total_amount.items():
tmp_list = sorted(
total_data.items(),
key=lambda x: isinstance(x[0], int)
and isinstance(x[1], dict)
and x[1]["partner_name"]
or x[0],
key=lambda x: ("\xff" if not x[0] else x[1]["partner_name"])
if isinstance(x[0], int)
else "!", # ~ is the last ASCII printable char, and ! the first
)
total_amount[acc_id] = {}
for key, value in tmp_list:
Expand Down