Show party name in General Ledger print report (#8760)
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.html b/erpnext/accounts/report/general_ledger/general_ledger.html
index 9591811..b0ca19f 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.html
+++ b/erpnext/accounts/report/general_ledger/general_ledger.html
@@ -5,7 +5,15 @@
</div>
{% } %}
<h2 class="text-center">{%= __("Statement of Account") %}</h2>
-<h4 class="text-center">{%= (filters.party || filters.account) && ((filters.party || filters.account) + ", ") || "" %} {%= filters.company %}</h4>
+<h4 class="text-center">
+ {% if (filters.party_name) { %}
+ {%= filters.party_name %}
+ {% } else if (filters.party) { %}
+ {%= filters.party %}
+ {% } else if (filters.account) { %}
+ {%= filters.account %}
+ {% } %}
+</h4>
<h5 class="text-center">
{%= 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 a422871..b519965 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.js
+++ b/erpnext/accounts/report/general_ledger/general_ledger.js
@@ -74,9 +74,28 @@
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"),
"fieldtype": "Check",