Anand Doshi 8e332ffd16 Merge remote-tracking branch 'webnotes/4.0.0-wip' into permissions
Conflicts:
	erpnext/accounts/page/accounts_browser/accounts_browser.css
	erpnext/controllers/buying_controller.py
	erpnext/manufacturing/doctype/production_order/production_order.py
	erpnext/patches/patch_list.py
	erpnext/selling/doctype/customer/customer.txt
	erpnext/selling/doctype/sales_order/sales_order.py
	erpnext/selling/doctype/sales_order/test_sales_order.py
	erpnext/setup/doctype/features_setup/features_setup.txt
	erpnext/stock/doctype/stock_entry/test_stock_entry.py
	erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
	startup/query_handlers.py
2013-12-26 19:12:51 +05:30

53 lines
1.9 KiB
Python

# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
delete_doctypes()
rename_module()
cleanup_bom()
rebuild_exploded_bom()
def delete_doctypes():
webnotes.delete_doc("DocType", "Production Control")
webnotes.delete_doc("DocType", "BOM Control")
def rename_module():
webnotes.reload_doc("core", "doctype", "role")
webnotes.reload_doc("core", "doctype", "page")
webnotes.reload_doc("core", "doctype", "module_def")
if webnotes.conn.exists("Role", "Production User"):
webnotes.rename_doc("Role", "Production User", "Manufacturing User")
if webnotes.conn.exists("Role", "Production Manager"):
webnotes.rename_doc("Role", "Production Manager", "Manufacturing Manager")
if webnotes.conn.exists("Page", "manufacturing-home"):
webnotes.delete_doc("Page", "production-home")
else:
webnotes.rename_doc("Page", "production-home", "manufacturing-home")
if webnotes.conn.exists("Module Def", "Production"):
webnotes.rename_doc("Module Def", "Production", "Manufacturing")
modules_list = webnotes.conn.get_global('modules_list')
if modules_list:
webnotes.conn.set_global("modules_list", modules_list.replace("Production",
"Manufacturing"))
# set end of life to null if "0000-00-00"
webnotes.conn.sql("""update `tabItem` set end_of_life=null where end_of_life='0000-00-00'""")
def rebuild_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 = 1 where ifnull(is_active, 'No') = 'Yes'""")
webnotes.conn.sql("""UPDATE `tabBOM` SET is_active = 0 where ifnull(is_active, 'No') = 'No'""")
webnotes.reload_doc("manufacturing", "doctype", "bom")
webnotes.conn.sql("""update `tabBOM` set with_operations = 1""")