From 06bb1a32086ffb5729236e2ed48183a5d44feb6e Mon Sep 17 00:00:00 2001 From: Gursheen Anand Date: Thu, 19 Oct 2023 16:54:10 +0530 Subject: [PATCH] fix: sort by section code (cherry picked from commit 4471ad581e1c3d220468f42170a09739a46dcc21) --- .../report/tax_withholding_details/tax_withholding_details.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py b/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py index 611893bf7ec3..6f2ec176f0a9 100644 --- a/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py +++ b/erpnext/accounts/report/tax_withholding_details/tax_withholding_details.py @@ -97,7 +97,7 @@ def get_result( row.update( { - "section_code": tax_withholding_category, + "section_code": tax_withholding_category or "", "entity_type": party_map.get(party, {}).get(party_type), "rate": rate, "total_amount": total_amount, @@ -111,6 +111,8 @@ def get_result( ) out.append(row) + out.sort(key=lambda x: x["section_code"]) + return out