diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js index b24a17d3448..ca2d5f0f1c1 100644 --- a/erpnext/accounts/doctype/account/account_tree.js +++ b/erpnext/accounts/doctype/account/account_tree.js @@ -15,8 +15,8 @@ frappe.treeview_settings["Account"] = { menu_items:[ { label: __('New Company'), - action: function() { newdoc('Company'); }, - condition: 'frappe.boot.user.can_create.indexOf("Company") === -1' + action: function() { frappe.new_doc("Company", true) }, + condition: 'frappe.boot.user.can_create.indexOf("Company") !== -1' } ], fields: [ diff --git a/erpnext/accounts/doctype/cost_center/cost_center_tree.js b/erpnext/accounts/doctype/cost_center/cost_center_tree.js index ac82f23cb46..d8d45c5a2a4 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center_tree.js +++ b/erpnext/accounts/doctype/cost_center/cost_center_tree.js @@ -14,8 +14,8 @@ frappe.treeview_settings["Cost Center"] = { menu_items:[ { label: __('New Company'), - action: function() { newdoc('Company'); }, - condition: 'frappe.boot.user.can_create.indexOf("Company") === -1' + action: function() { frappe.new_doc("Company", true) }, + condition: 'frappe.boot.user.can_create.indexOf("Company") !== -1' } ], fields:[ diff --git a/erpnext/hooks.py b/erpnext/hooks.py index d20e20b36f6..5d43e70abe2 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -33,7 +33,7 @@ on_session_creation = "erpnext.shopping_cart.utils.set_cart_count" on_logout = "erpnext.shopping_cart.utils.clear_cart_count" remember_selected = ['Company', 'Cost Center', 'Project'] -treeviews = ['Account', 'Cost Center', 'Warehouse', 'Item Group', 'Customer Group', 'Sales Person', 'Territory'] +treeviews = ['Account', 'Cost Center', 'Warehouse', 'Item Group', 'Customer Group', 'Sales Person', 'Territory', "BOM"] # website update_website_context = "erpnext.shopping_cart.utils.update_website_context" diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index de8ac946c9a..832402e51eb 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -24,6 +24,9 @@ frappe.ui.form.on("BOM", { frm.events.update_cost(frm); }); frm.add_custom_button(__("Browse BOM"), function() { + frappe.route_options = { + "bom": frm.doc.name + }; frappe.set_route("Tree", "BOM"); }); } diff --git a/erpnext/manufacturing/doctype/bom/bom_tree.js b/erpnext/manufacturing/doctype/bom/bom_tree.js index 0404360ee41..f6a205f4609 100644 --- a/erpnext/manufacturing/doctype/bom/bom_tree.js +++ b/erpnext/manufacturing/doctype/bom/bom_tree.js @@ -32,4 +32,13 @@ frappe.treeview_settings["BOM"] = { } } ], + menu_items: [ + { + label: __("New BOM"), + action: function() { + frappe.new_doc("BOM", true) + }, + condition: 'frappe.boot.user.can_create.indexOf("BOM") !== -1' + } + ] } \ No newline at end of file