mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-01 09:36:53 +00:00
feat: add party name in GL entries
(cherry picked from commit 3d94a7cf2c)
This commit is contained in:
@@ -203,6 +203,12 @@ def get_gl_entries(filters, accounting_dimensions):
|
|||||||
as_dict=1,
|
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"):
|
if filters.get("presentation_currency"):
|
||||||
return convert_to_presentation_currency(gl_entries, currency_map, filters)
|
return convert_to_presentation_currency(gl_entries, currency_map, filters)
|
||||||
else:
|
else:
|
||||||
@@ -337,6 +343,17 @@ def get_conditions(filters):
|
|||||||
return "and {}".format(" and ".join(conditions)) if conditions else ""
|
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):
|
def get_accounts_with_children(accounts):
|
||||||
if not isinstance(accounts, list):
|
if not isinstance(accounts, list):
|
||||||
accounts = [d.strip() for d in accounts.strip().split(",") if d]
|
accounts = [d.strip() for d in accounts.strip().split(",") if d]
|
||||||
|
|||||||
Reference in New Issue
Block a user