fix(ledger-summary-report): show party group and territory

(cherry picked from commit 231479a6e2)

# Conflicts:
#	erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py
This commit is contained in:
l0gesh29
2025-11-17 13:42:43 +05:30
committed by Mergify
parent e8051ba180
commit 56f03aee02

View File

@@ -69,12 +69,18 @@ class PartyLedgerSummaryReport:
party_type = self.filters.party_type party_type = self.filters.party_type
doctype = qb.DocType(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) conditions = self.get_party_conditions(doctype)
query = ( query = qb.from_(doctype).select(*party_details_fields).where(Criterion.all(conditions))
qb.from_(doctype)
.select(doctype.name.as_("party"), f"{scrub(party_type)}_name")
.where(Criterion.all(conditions))
)
from frappe.desk.reportview import build_match_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" 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 += [ columns += [
{ {
"label": _("Opening Balance"), "label": _("Opening Balance"),
@@ -213,6 +244,7 @@ class PartyLedgerSummaryReport:
}, },
] ]
<<<<<<< HEAD
# Hidden columns for handling 'User Permissions' # Hidden columns for handling 'User Permissions'
if self.filters.party_type == "Customer": if self.filters.party_type == "Customer":
columns += [ 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 return columns
def get_data(self): def get_data(self):