From 56f03aee027486897a4ed4e327473bf957895112 Mon Sep 17 00:00:00 2001 From: l0gesh29 Date: Mon, 17 Nov 2025 13:42:43 +0530 Subject: [PATCH] fix(ledger-summary-report): show party group and territory (cherry picked from commit 231479a6e2e6b8ca97d4c58036c6ac4755c83c63) # Conflicts: # erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py --- .../customer_ledger_summary.py | 45 ++++++++++++++++--- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py b/erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py index 6f5fe349dd2..5b669ba5826 100644 --- a/erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py +++ b/erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py @@ -69,12 +69,18 @@ class PartyLedgerSummaryReport: party_type = self.filters.party_type doctype = qb.DocType(party_type) + + party_details_fields = [ + doctype.name.as_("party"), + f"{scrub(party_type)}_name", + f"{scrub(party_type)}_group", + ] + + if party_type == "Customer": + party_details_fields.append(doctype.territory) + conditions = self.get_party_conditions(doctype) - query = ( - qb.from_(doctype) - .select(doctype.name.as_("party"), f"{scrub(party_type)}_name") - .where(Criterion.all(conditions)) - ) + query = qb.from_(doctype).select(*party_details_fields).where(Criterion.all(conditions)) from frappe.desk.reportview import build_match_conditions @@ -153,6 +159,31 @@ class PartyLedgerSummaryReport: credit_or_debit_note = "Credit Note" if self.filters.party_type == "Customer" else "Debit Note" + if self.filters.party_type == "Customer": + columns += [ + { + "label": _("Customer Group"), + "fieldname": "customer_group", + "fieldtype": "Link", + "options": "Customer Group", + }, + { + "label": _("Territory"), + "fieldname": "territory", + "fieldtype": "Link", + "options": "Territory", + }, + ] + else: + columns += [ + { + "label": _("Supplier Group"), + "fieldname": "supplier_group", + "fieldtype": "Link", + "options": "Supplier Group", + } + ] + columns += [ { "label": _("Opening Balance"), @@ -213,6 +244,7 @@ class PartyLedgerSummaryReport: }, ] +<<<<<<< HEAD # Hidden columns for handling 'User Permissions' if self.filters.party_type == "Customer": columns += [ @@ -242,6 +274,9 @@ class PartyLedgerSummaryReport: } ] +======= + columns.append({"label": _("Dr/Cr"), "fieldname": "dr_or_cr", "fieldtype": "Data", "width": 100}) +>>>>>>> 231479a6e2 (fix(ledger-summary-report): show party group and territory) return columns def get_data(self):