fix: Test, Sider and Added button to access log from Tool
(cherry picked from commit f3715ab382)
# Conflicts:
# erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py
This commit is contained in:
@@ -21,6 +21,10 @@ frappe.ui.form.on('BOM Update Tool', {
|
|||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frm.disable_save();
|
frm.disable_save();
|
||||||
frm.events.disable_button(frm, "replace");
|
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) => {
|
disable_button: (frm, field, disable=true) => {
|
||||||
|
|||||||
@@ -8,10 +8,12 @@ if TYPE_CHECKING:
|
|||||||
from erpnext.manufacturing.doctype.bom_update_log.bom_update_log import BOMUpdateLog
|
from erpnext.manufacturing.doctype.bom_update_log.bom_update_log import BOMUpdateLog
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
<<<<<<< HEAD
|
||||||
from frappe.utils import cstr, flt
|
from frappe.utils import cstr, flt
|
||||||
from six import string_types
|
from six import string_types
|
||||||
|
=======
|
||||||
|
>>>>>>> f3715ab382 (fix: Test, Sider and Added button to access log from Tool)
|
||||||
|
|
||||||
from erpnext.manufacturing.doctype.bom.bom import get_boms_in_bottom_up_order
|
from erpnext.manufacturing.doctype.bom.bom import get_boms_in_bottom_up_order
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import frappe
|
|||||||
from frappe.tests.utils import FrappeTestCase
|
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_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.manufacturing.doctype.production_plan.test_production_plan import make_bom
|
||||||
from erpnext.stock.doctype.item.test_item import create_item
|
from erpnext.stock.doctype.item.test_item import create_item
|
||||||
|
|
||||||
@@ -19,18 +20,19 @@ class TestBOMUpdateTool(FrappeTestCase):
|
|||||||
bom_doc.items[1].item_code = "_Test Item"
|
bom_doc.items[1].item_code = "_Test Item"
|
||||||
bom_doc.insert()
|
bom_doc.insert()
|
||||||
|
|
||||||
update_tool = frappe.get_doc("BOM Update Tool")
|
boms = frappe._dict(
|
||||||
update_tool.current_bom = current_bom
|
current_bom=current_bom,
|
||||||
update_tool.new_bom = bom_doc.name
|
new_bom=bom_doc.name
|
||||||
update_tool.replace_bom()
|
)
|
||||||
|
replace_bom(boms)
|
||||||
|
|
||||||
self.assertFalse(frappe.db.sql("select name from `tabBOM Item` where bom_no=%s", current_bom))
|
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))
|
self.assertTrue(frappe.db.sql("select name from `tabBOM Item` where bom_no=%s", bom_doc.name))
|
||||||
|
|
||||||
# reverse, as it affects other testcases
|
# reverse, as it affects other testcases
|
||||||
update_tool.current_bom = bom_doc.name
|
boms.current_bom = bom_doc.name
|
||||||
update_tool.new_bom = current_bom
|
boms.new_bom = current_bom
|
||||||
update_tool.replace_bom()
|
replace_bom(boms)
|
||||||
|
|
||||||
def test_bom_cost(self):
|
def test_bom_cost(self):
|
||||||
for item in ["BOM Cost Test Item 1", "BOM Cost Test Item 2", "BOM Cost Test Item 3"]:
|
for item in ["BOM Cost Test Item 1", "BOM Cost Test Item 2", "BOM Cost Test Item 3"]:
|
||||||
|
|||||||
Reference in New Issue
Block a user