treeview not set when routed from bom form (#12707)

diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index a06645a..fb52d52 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -592,7 +592,7 @@
 
 @frappe.whitelist()
 def get_children(doctype, parent=None, is_root=False, **filters):
-	if not parent:
+	if not parent or parent=="BOM":
 		frappe.msgprint(_('Please select a BOM'))
 		return
 
diff --git a/erpnext/manufacturing/doctype/bom/bom_tree.js b/erpnext/manufacturing/doctype/bom/bom_tree.js
index 854f633..6cbd7a2 100644
--- a/erpnext/manufacturing/doctype/bom/bom_tree.js
+++ b/erpnext/manufacturing/doctype/bom/bom_tree.js
@@ -11,7 +11,8 @@
 	title: "BOM",
 	breadcrumb: "Manufacturing",
 	disable_add_node: true,
-	root_label: "All Bill of Materials", //fieldname from filters
+	root_label: "BOM", //fieldname from filters
+	get_tree_root: false,
 	get_label: function(node) {
 		if(node.data.qty) {
 			return node.data.qty + " x " + node.data.item_code;
@@ -19,6 +20,23 @@
 			return node.data.item_code || node.data.value;
 		}
 	},
+	onload: function(me) {
+		var label = frappe.get_route()[0] + "/" + frappe.get_route()[1];
+		if(frappe.pages[label]) {
+			delete frappe.pages[label];
+		}
+
+		var filter = me.opts.filters[0];
+		if(frappe.route_options && frappe.route_options[filter.fieldname]) {
+			var val = frappe.route_options[filter.fieldname];
+			delete frappe.route_options[filter.fieldname];
+			filter.default = "";
+			me.args[filter.fieldname] = val;
+			me.root_label = val;
+			me.page.set_title(val);
+		}
+		me.make_tree();
+	},
 	toolbar: [
 		{ toggle_btn: true },
 		{