From 734d7795f80f8b151b4a7b29706bfae8ecdc922a Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 11 May 2017 11:38:30 +0530 Subject: [PATCH] Show party name in General Ledger print report (#8760) --- .../report/general_ledger/general_ledger.html | 10 +++++++++- .../report/general_ledger/general_ledger.js | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.html b/erpnext/accounts/report/general_ledger/general_ledger.html index 95918117c7..b0ca19f325 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.html +++ b/erpnext/accounts/report/general_ledger/general_ledger.html @@ -5,7 +5,15 @@ {% } %}

{%= __("Statement of Account") %}

-

{%= (filters.party || filters.account) && ((filters.party || filters.account) + ", ") || "" %} {%= filters.company %}

+

+ {% if (filters.party_name) { %} + {%= filters.party_name %} + {% } else if (filters.party) { %} + {%= filters.party %} + {% } else if (filters.account) { %} + {%= filters.account %} + {% } %} +

{%= dateutil.str_to_user(filters.from_date) %} {%= __("to") %} diff --git a/erpnext/accounts/report/general_ledger/general_ledger.js b/erpnext/accounts/report/general_ledger/general_ledger.js index a422871b05..b5199650fb 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.js +++ b/erpnext/accounts/report/general_ledger/general_ledger.js @@ -74,8 +74,27 @@ frappe.query_reports["General Ledger"] = { frappe.throw(__("Please select Party Type first")); } return party_type; + }, + change: function() { + var party_type = frappe.query_report_filters_by_name.party_type.get_value(); + var party = frappe.query_report_filters_by_name.party.get_value(); + if(!party_type || !party) { + frappe.query_report_filters_by_name.party_name.set_value(""); + return; + } + + var fieldname = party_type.toLowerCase() + "_name"; + frappe.db.get_value(party_type, party, fieldname, function(value) { + frappe.query_report_filters_by_name.party_name.set_value(value[fieldname]); + }); } }, + { + "fieldname":"party_name", + "label": __("Party Name"), + "fieldtype": "Data", + "hidden": 1 + }, { "fieldname":"group_by_voucher", "label": __("Group by Voucher"),