fix: Test, Sider and Added button to access log from Tool
diff --git a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.js b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.js
index 0c98167..a793ed9 100644
--- a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.js
+++ b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.js
@@ -21,6 +21,10 @@
refresh: function(frm) {
frm.disable_save();
frm.events.disable_button(frm, "replace");
+
+ frm.add_custom_button(__("View BOM Update Log"), () => {
+ frappe.set_route("List", "BOM Update Log");
+ });
},
disable_button: (frm, field, disable=true) => {
diff --git a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py
index bc3e820..3da8afe 100644
--- a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py
+++ b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py
@@ -8,9 +8,7 @@
from erpnext.manufacturing.doctype.bom_update_log.bom_update_log import BOMUpdateLog
import frappe
-from frappe import _
from frappe.model.document import Document
-from frappe.utils import cstr, flt
from erpnext.manufacturing.doctype.bom.bom import get_boms_in_bottom_up_order
diff --git a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py
index b4c625d..c99e888 100644
--- a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py
+++ b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py
@@ -5,6 +5,7 @@
from frappe.tests.utils import FrappeTestCase
from erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool import update_cost
+from erpnext.manufacturing.doctype.bom_update_log.bom_update_log import replace_bom
from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom
from erpnext.stock.doctype.item.test_item import create_item
@@ -18,18 +19,19 @@
bom_doc.items[1].item_code = "_Test Item"
bom_doc.insert()
- update_tool = frappe.get_doc("BOM Update Tool")
- update_tool.current_bom = current_bom
- update_tool.new_bom = bom_doc.name
- update_tool.replace_bom()
+ boms = frappe._dict(
+ current_bom=current_bom,
+ new_bom=bom_doc.name
+ )
+ replace_bom(boms)
self.assertFalse(frappe.db.sql("select name from `tabBOM Item` where bom_no=%s", current_bom))
self.assertTrue(frappe.db.sql("select name from `tabBOM Item` where bom_no=%s", bom_doc.name))
# reverse, as it affects other testcases
- update_tool.current_bom = bom_doc.name
- update_tool.new_bom = current_bom
- update_tool.replace_bom()
+ boms.current_bom = bom_doc.name
+ boms.new_bom = current_bom
+ replace_bom(boms)
def test_bom_cost(self):
for item in ["BOM Cost Test Item 1", "BOM Cost Test Item 2", "BOM Cost Test Item 3"]: