[enhancement] BOM treeview

This commit is contained in:
Saurabh 2016-05-27 17:06:27 +05:30
parent d647945102
commit 5f48cb6128
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,34 @@
frappe.treeview_settings["BOM"] = {
get_tree_nodes: 'erpnext.manufacturing.page.bom_browser.bom_browser.get_children',
filters: [
{
fieldname: "bom",
fieldtype:"Link",
options: "BOM",
label: __("BOM")
}
],
breadcrumb: "Manufacturing",
disable_add_node: true,
label: "bom", // should be fieldname from filters
get_label: function(node) {
if(node.data.qty) {
return node.data.qty + " x " + node.data.item_code;
} else {
return node.data.item_code || node.data.value;
}
},
toolbar: [
{toggle_btn: true},
{
label:__("Edit"),
condition: function(node) {
return node.expandable;
},
click: function(node) {
frappe.set_route("Form", "BOM", node.data.value);
}
}
],
}

View File

@ -5,7 +5,8 @@ from __future__ import unicode_literals
import frappe
@frappe.whitelist()
def get_children(parent):
def get_children():
parent = frappe.local.form_dict.get('bom')
return frappe.db.sql("""select item_code,
bom_no as value, qty,
if(ifnull(bom_no, "")!="", 1, 0) as expandable