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

This commit is contained in:
Zarrar 2018-01-31 13:07:04 +05:30 committed by Nabin Hait
parent bc640fe6a6
commit dea99cc3a8
2 changed files with 20 additions and 2 deletions

View File

@ -592,7 +592,7 @@ def validate_bom_no(item, bom_no):
@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

View File

@ -11,7 +11,8 @@ frappe.treeview_settings["BOM"] = {
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 @@ frappe.treeview_settings["BOM"] = {
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 },
{