From e7ba420687d5f1a5f3cd40e6d9458fe46c9718b3 Mon Sep 17 00:00:00 2001 From: Khushi Rawat <142375893+khushi8112@users.noreply.github.com> Date: Tue, 3 Jun 2025 12:05:43 +0530 Subject: [PATCH] feat: added column to show Dr/Cr --- .../customer_ledger_summary/customer_ledger_summary.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 b90f922d82b..8d28ed302d2 100644 --- a/erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py +++ b/erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py @@ -242,6 +242,8 @@ class PartyLedgerSummaryReport: } ] + if self.filters.show_dr_cr: + columns.append({"label": "Dr/Cr", "fieldname": "dr_or_cr", "fieldtype": "Data", "width": 100}) return columns def get_data(self): @@ -300,6 +302,14 @@ class PartyLedgerSummaryReport: for account in self.party_adjustment_accounts: row["adj_" + scrub(account)] = adjustments.get(account, 0) + if self.filters.show_dr_cr: + if self.filters.party_type == "Customer": + balance = row.get("closing_balance", 0) + row["dr_or_cr"] = "Dr" if balance > 0 else "Cr" if balance < 0 else "" + else: + balance = row.get("closing_balance", 0) + row["dr_or_cr"] = "Cr" if balance > 0 else "Dr" if balance < 0 else "" + out.append(row) return out