brotherton-erpnext/patches/october_2013/p07_rename_for_territory.py
Anand Doshi d47db9bccf Merge branch '1310' of github.com:webnotes/erpnext
Conflicts:
	patches/october_2013/p07_rename_for_territory.py
	patches/october_2013/p08_cleanup_after_item_price_module_change.py
	setup/doctype/setup_control/setup_control.py
	utilities/demo/demo_docs/Lead.csv
2013-11-04 15:34:10 +05:30

25 lines
785 B
Python

# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes, os
def execute():
from webnotes.utils import get_base_path
import shutil
webnotes.reload_doc("core", "doctype", "doctype")
tables = webnotes.conn.sql_list("show tables")
if "tabApplicable Territory" not in tables:
webnotes.rename_doc("DocType", "For Territory", "Applicable Territory", force=True)
webnotes.reload_doc("setup", "doctype", "applicable_territory")
path = os.path.join(get_base_path(), "app", "setup", "doctype", "for_territory")
if os.path.exists(path):
shutil.rmtree(path)
if webnotes.conn.exists("DocType", "For Territory"):
webnotes.delete_doc("DocType", "For Territory")