mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-18 12:39:18 +00:00
Merge pull request #50731 from frappe/mergify/bp/version-15-hotfix/pr-50561
fix(ledger-summary-report): show party group and territory (backport #50561)
This commit is contained in:
@@ -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,35 +244,6 @@ class PartyLedgerSummaryReport:
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
# Hidden columns for handling 'User Permissions'
|
|
||||||
if self.filters.party_type == "Customer":
|
|
||||||
columns += [
|
|
||||||
{
|
|
||||||
"label": _("Territory"),
|
|
||||||
"fieldname": "territory",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"options": "Territory",
|
|
||||||
"hidden": 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": _("Customer Group"),
|
|
||||||
"fieldname": "customer_group",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"options": "Customer Group",
|
|
||||||
"hidden": 1,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
columns += [
|
|
||||||
{
|
|
||||||
"label": _("Supplier Group"),
|
|
||||||
"fieldname": "supplier_group",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"options": "Supplier Group",
|
|
||||||
"hidden": 1,
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
return columns
|
return columns
|
||||||
|
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user