diff --git a/erpnext/public/build.json b/erpnext/public/build.json index 45de6eb294f..bb1980321b0 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 00000000000..68c3d5b98d0 --- /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