[Fix] General Ledger Report (#13374)

* error fix if party_type = student or shareholder

* clear party filter when party_type changes to avoid error throw

* dict with values of party_name in utils.js

* fetch party_name from erpnext.utils.get_party_name

* Update general_ledger.py
This commit is contained in:
Shreya Shah 2018-03-27 11:29:25 +05:30 committed by Nabin Hait
parent c9a1eb1081
commit 149f7ee875
3 changed files with 12 additions and 4 deletions

View File

@ -61,7 +61,10 @@ frappe.query_reports["General Ledger"] = {
"label": __("Party Type"),
"fieldtype": "Link",
"options": "Party Type",
"default": ""
"default": "",
on_change: function() {
frappe.query_report_filters_by_name.party.set_value("");
}
},
{
"fieldname":"party",
@ -82,8 +85,7 @@ frappe.query_reports["General Ledger"] = {
frappe.query_report_filters_by_name.party_name.set_value("");
return;
}
var fieldname = frappe.scrub(party_type) + "_name";
var fieldname = erpnext.utils.get_party_name(party_type) || "name";
frappe.db.get_value(party_type, party, fieldname, function(value) {
frappe.query_report_filters_by_name.party_name.set_value(value[fieldname]);
});

View File

@ -71,7 +71,7 @@ def set_account_currency(filters):
if gle_currency:
account_currency = gle_currency
else:
account_currency = None if filters.party_type == "Employee" else \
account_currency = None if filters.party_type in ["Employee", "Student", "Shareholder"] else \
frappe.db.get_value(filters.party_type, filters.party, "default_currency")
filters["account_currency"] = account_currency or filters.company_currency

View File

@ -105,6 +105,12 @@ $.extend(erpnext.utils, {
}
},
get_party_name: function(party_type) {
var dict = {'Customer': 'customer_name', 'Supplier': 'supplier_name', 'Employee': 'employee_name',
'Member': 'member_name'};
return dict[party_type];
},
copy_value_in_all_row: function(doc, dt, dn, table_fieldname, fieldname) {
var d = locals[dt][dn];
if(d[fieldname]){