From 50ea99e35bcebd9c2c6e9295603adb52418a0201 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Tue, 28 May 2019 12:13:53 +0530 Subject: [PATCH] fix: Is group filter for dimensions for doctype --- erpnext/public/build.json | 3 ++- .../public/js/utils/dimension_tree_filter.js | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 erpnext/public/js/utils/dimension_tree_filter.js diff --git a/erpnext/public/build.json b/erpnext/public/build.json index 45de6eb294..bb1980321b 100644 --- a/erpnext/public/build.json +++ b/erpnext/public/build.json @@ -48,7 +48,8 @@ "public/js/utils/customer_quick_entry.js", "public/js/education/student_button.html", "public/js/education/assessment_result_tool.html", - "public/js/hub/hub_factory.js" + "public/js/hub/hub_factory.js", + "public/js/utils/dimension_tree_filter.js" ], "js/item-dashboard.min.js": [ "stock/dashboard/item_dashboard.html", diff --git a/erpnext/public/js/utils/dimension_tree_filter.js b/erpnext/public/js/utils/dimension_tree_filter.js new file mode 100644 index 0000000000..68c3d5b98d --- /dev/null +++ b/erpnext/public/js/utils/dimension_tree_filter.js @@ -0,0 +1,24 @@ +frappe.provide('frappe.ui.form'); + +let doclist = ["GL Entry", "Sales Invoice", "Purchase Invoice", "Payment Entry", "Asset", + "Expense Claim", "Stock Entry", "Budget", "Payroll Entry", "Delivery Note", "Sales Invoice Item", "Purchase Invoice Item", + "Purchase Order Item", "Journal Entry Account", "Material Request Item", "Delivery Note Item", "Purchase Receipt Item", + "Stock Entry Detail", "Payment Entry Deduction", "Sales Taxes and Charges", "Purchase Taxes and Charges", "Shipping Rule", + "Landed Cost Item", "Asset Value Adjustment", "Loyalty Program", "Fee Schedule", "Fee Structure", "Stock Reconciliation", + "Travel Request", "Fees", "POS Profile"] + +let dimension_filters = erpnext.get_dimension_filters() + + doclist.forEach((doctype) => { + frappe.ui.form.on(doctype, { + onload: function(frm) { + dimension_filters.then((dimensions) => { + dimensions.forEach((dimension) => { + frm.set_query(dimension['fieldname'],{ + "is_group": 0 + }); + }); + }); + } + }); + }) \ No newline at end of file