2013-10-31 14:20:51 +00:00
|
|
|
# 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():
|
2013-11-04 07:44:39 +00:00
|
|
|
from webnotes.utils import get_base_path
|
2013-11-04 10:01:00 +00:00
|
|
|
import shutil
|
2013-10-31 14:20:51 +00:00
|
|
|
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")
|
|
|
|
|
2013-11-04 07:44:39 +00:00
|
|
|
path = os.path.join(get_base_path(), "app", "setup", "doctype", "for_territory")
|
|
|
|
if os.path.exists(path):
|
2013-11-04 10:01:00 +00:00
|
|
|
shutil.rmtree(path)
|
2013-10-31 14:20:51 +00:00
|
|
|
|
|
|
|
if webnotes.conn.exists("DocType", "For Territory"):
|
2013-11-04 09:52:50 +00:00
|
|
|
webnotes.delete_doc("DocType", "For Territory")
|