mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 12:49:10 +00:00
bom cleanup
This commit is contained in:
@@ -4,12 +4,14 @@ def execute():
|
||||
delete_doctypes()
|
||||
rename_module()
|
||||
rebuilt_exploded_bom()
|
||||
cleanup_bom()
|
||||
|
||||
def delete_doctypes():
|
||||
from webnotes.model import delete_doc
|
||||
delete_doc("DocType", "Production Control")
|
||||
delete_doc("DocType", "BOM Control")
|
||||
|
||||
|
||||
def rename_module():
|
||||
webnotes.reload_doc("core", "doctype", "role")
|
||||
webnotes.reload_doc("core", "doctype", "page")
|
||||
@@ -38,3 +40,8 @@ def rebuilt_exploded_bom():
|
||||
from webnotes.model.code import get_obj
|
||||
for bom in webnotes.conn.sql("""select name from `tabBOM` where docstatus < 2"""):
|
||||
get_obj("BOM", bom[0], with_children=1).on_update()
|
||||
|
||||
def cleanup_bom():
|
||||
webnotes.conn.sql("""UPDATE `tabBOM` SET is_active = if(is_active='Yes', 1, 0),
|
||||
track_operations = 1""")
|
||||
|
||||
@@ -5,7 +5,7 @@ def execute():
|
||||
where docstatus = 2""")
|
||||
|
||||
for bom in cancelled_boms:
|
||||
webnotes.conn.sql("""update `tabBOM` set is_default=0, is_active='No'
|
||||
webnotes.conn.sql("""update `tabBOM` set is_default=0, is_active=0
|
||||
where name=%s""", (bom[0],))
|
||||
|
||||
webnotes.conn.sql("""update `tabItem` set default_bom=null
|
||||
|
||||
Reference in New Issue
Block a user