bom cleanup

This commit is contained in:
Nabin Hait
2012-12-14 14:25:51 +05:30
parent fce76cd5b2
commit 3adaf607f0
14 changed files with 170 additions and 153 deletions

View File

@@ -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""")

View File

@@ -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