feat: add party name in GL entries

(cherry picked from commit 3d94a7cf2c)
This commit is contained in:
khushi8112
2025-07-30 16:58:38 +05:30
committed by Mergify
parent 680fa3b8f3
commit 3763ad451b

View File

@@ -203,6 +203,12 @@ def get_gl_entries(filters, accounting_dimensions):
as_dict=1,
)
party_name_map = get_party_name_map()
for gl_entry in gl_entries:
if gl_entry.party_type and gl_entry.party:
gl_entry.party_name = party_name_map.get(gl_entry.party_type, {}).get(gl_entry.party)
if filters.get("presentation_currency"):
return convert_to_presentation_currency(gl_entries, currency_map, filters)
else:
@@ -337,6 +343,17 @@ def get_conditions(filters):
return "and {}".format(" and ".join(conditions)) if conditions else ""
def get_party_name_map():
party_map = {}
customers = frappe.get_all("Customer", fields=["name", "customer_name"])
party_map["Customer"] = {c.name: c.customer_name for c in customers}
suppliers = frappe.get_all("Supplier", fields=["name", "supplier_name"])
party_map["Supplier"] = {s.name: s.supplier_name for s in suppliers}
return party_map
def get_accounts_with_children(accounts):
if not isinstance(accounts, list):
accounts = [d.strip() for d in accounts.strip().split(",") if d]