From 621247807a0784c20363c4e0bb951c176b528ad9 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Thu, 30 Jun 2016 13:33:49 +0530 Subject: [PATCH] [fix] BOM tree as default view --- erpnext/accounts/doctype/account/account_tree.js | 4 ++-- erpnext/accounts/doctype/cost_center/cost_center_tree.js | 4 ++-- erpnext/hooks.py | 2 +- erpnext/manufacturing/doctype/bom/bom.js | 3 +++ erpnext/manufacturing/doctype/bom/bom_tree.js | 9 +++++++++ 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js index b24a17d344..ca2d5f0f1c 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 ac82f23cb4..d8d45c5a2a 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 d20e20b36f..5d43e70abe 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 de8ac946c9..832402e51e 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 0404360ee4..f6a205f460 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