[cleanup] UI Fixes, minor
diff --git a/patches/1311/p01_cleanup.py b/patches/1311/p01_cleanup.py
index 6c45aae..cf7ae6e 100644
--- a/patches/1311/p01_cleanup.py
+++ b/patches/1311/p01_cleanup.py
@@ -1,6 +1,15 @@
 import webnotes
 
 def execute():
-	from core.doctype.custom_field.custom_field import delete_and_create_custom_field_if_values_exist
-	delete_and_create_custom_field_if_values_exist("Material Request", 
-		{"fieldtype":"Text", "fieldname":"remark", "label":"Remarks","insert_after":"Fiscal Year"})
\ No newline at end of file
+	from core.doctype.custom_field.custom_field import create_custom_field_if_values_exist
+	create_custom_field_if_values_exist("Material Request", 
+		{"fieldtype":"Text", "fieldname":"remark", "label":"Remarks","insert_after":"Fiscal Year"})
+	create_custom_field_if_values_exist("Purchase Order", 
+		{"fieldtype":"Text", "fieldname":"instructions", "label":"Instructions","insert_after":"% Billed"})		
+	create_custom_field_if_values_exist("Purchase Order", 
+		{"fieldtype":"Text", "fieldname":"remarks", "label":"Remarks","insert_after":"% Billed"})
+	create_custom_field_if_values_exist("Purchase Order", 
+		{"fieldtype":"Text", "fieldname":"payment_terms", "label":"Payment Terms","insert_after":"Print Heading"})		
+	create_custom_field_if_values_exist("Lead", 
+		{"fieldtype":"Text", "fieldname":"remark", "label":"Remark","insert_after":"Territory"})
+		
\ No newline at end of file
diff --git a/patches/august_2013/p02_rename_price_list.py b/patches/august_2013/p02_rename_price_list.py
index 0a19299..dbe268f 100644
--- a/patches/august_2013/p02_rename_price_list.py
+++ b/patches/august_2013/p02_rename_price_list.py
@@ -6,7 +6,7 @@
 
 def execute():
 	webnotes.reload_doc("selling", "doctype", "shopping_cart_price_list")
-	webnotes.reload_doc("setup", "doctype", "item_price")
+	webnotes.reload_doc("stock", "doctype", "item_price")
 	
 	for t in [
 			("Supplier Quotation", "price_list_name", "buying_price_list"),
diff --git a/patches/june_2013/p03_buying_selling_for_price_list.py b/patches/june_2013/p03_buying_selling_for_price_list.py
index ead97ab..61cddd0 100644
--- a/patches/june_2013/p03_buying_selling_for_price_list.py
+++ b/patches/june_2013/p03_buying_selling_for_price_list.py
@@ -7,8 +7,8 @@
 import MySQLdb
 
 def execute():
-	webnotes.reload_doc("setup", "doctype", "price_list")
-	webnotes.reload_doc("setup", "doctype", "item_price")
+	webnotes.reload_doc("stock", "doctype", "price_list")
+	webnotes.reload_doc("stock", "doctype", "item_price")
 	
 	try:
 		for price_list in webnotes.conn.sql_list("""select name from `tabPrice List`"""):
diff --git a/patches/june_2013/p07_taxes_price_list_for_territory.py b/patches/june_2013/p07_taxes_price_list_for_territory.py
index f57ecf8..f6663bf 100644
--- a/patches/june_2013/p07_taxes_price_list_for_territory.py
+++ b/patches/june_2013/p07_taxes_price_list_for_territory.py
@@ -4,8 +4,8 @@
 import webnotes
 
 def execute():
-	webnotes.reload_doc("setup", "doctype", "for_territory")
-	webnotes.reload_doc("setup", "doctype", "price_list")
+	webnotes.reload_doc("setup", "doctype", "applicable_territory")
+	webnotes.reload_doc("stock", "doctype", "price_list")
 	webnotes.reload_doc("accounts", "doctype", "sales_taxes_and_charges_master")
 	webnotes.reload_doc("accounts", "doctype", "shipping_rule")
 	
@@ -14,12 +14,12 @@
 	
 	for parenttype in ["Sales Taxes and Charges Master", "Price List", "Shipping Rule"]:
 		for name in webnotes.conn.sql_list("""select name from `tab%s` main
-			where not exists (select parent from `tabFor Territory` territory
+			where not exists (select parent from `tabApplicable Territory` territory
 				where territory.parenttype=%s and territory.parent=main.name)""" % \
 				(parenttype, "%s"), (parenttype,)):
 			
 			doc = webnotes.doc({
-				"doctype": "For Territory",
+				"doctype": "Applicable Territory",
 				"__islocal": 1,
 				"parenttype": parenttype,
 				"parentfield": "valid_for_territories",
diff --git a/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py b/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py
index 209ebf3..4a90b8c 100644
--- a/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py
+++ b/patches/october_2013/p02_update_price_list_and_item_details_in_item_price.py
@@ -5,7 +5,7 @@
 import webnotes
 
 def execute():
-	webnotes.reload_doc("setup", "doctype", "item_price")
+	webnotes.reload_doc("stock", "doctype", "item_price")
 
 	webnotes.conn.sql("""update `tabItem Price` ip, `tabItem` i 
 		set ip.item_name=i.item_name, ip.item_description=i.description 
diff --git a/patches/october_2013/p07_rename_for_territory.py b/patches/october_2013/p07_rename_for_territory.py
new file mode 100644
index 0000000..96c72f3
--- /dev/null
+++ b/patches/october_2013/p07_rename_for_territory.py
@@ -0,0 +1,24 @@
+# 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")
diff --git a/patches/october_2013/p08_cleanup_after_item_price_module_change.py b/patches/october_2013/p08_cleanup_after_item_price_module_change.py
new file mode 100644
index 0000000..ba0ab8d
--- /dev/null
+++ b/patches/october_2013/p08_cleanup_after_item_price_module_change.py
@@ -0,0 +1,14 @@
+# 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():
+	import shutil
+	from webnotes.utils import get_base_path
+	
+	for dt in ("item_price", "price_list"):
+		path = os.path.join(get_base_path(), "app", "setup", "doctype", dt)
+		if os.path.exists(path):
+			shutil.rmtree(path)
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 63f06f7..1581841 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -161,7 +161,6 @@
 	"execute:webnotes.delete_doc('Report', 'Sales Orders Pending To Be Delivered')",
 	"patches.june_2013.p05_remove_unused_doctypes",
 	"patches.june_2013.p06_drop_unused_tables",
-	"patches.june_2013.p07_taxes_price_list_for_territory",
 	"patches.june_2013.p08_shopping_cart_settings",
 	"patches.june_2013.p09_update_global_defaults",
 	"patches.june_2013.p10_lead_address",
@@ -235,4 +234,7 @@
 	"patches.october_2013.p04_update_report_permission",
 	"patches.october_2013.p05_delete_gl_entries_for_cancelled_vouchers",
 	"patches.october_2013.p06_update_control_panel_and_global_defaults",
+	"patches.october_2013.p07_rename_for_territory",
+	"patches.june_2013.p07_taxes_price_list_for_territory",
+	"patches.october_2013.p08_cleanup_after_item_price_module_change",
 ]
\ No newline at end of file
diff --git a/patches/september_2013/p03_modify_item_price_include_in_price_list.py b/patches/september_2013/p03_modify_item_price_include_in_price_list.py
index 8ca6d76..2400918 100644
--- a/patches/september_2013/p03_modify_item_price_include_in_price_list.py
+++ b/patches/september_2013/p03_modify_item_price_include_in_price_list.py
@@ -5,8 +5,8 @@
 import webnotes
 
 def execute():
-	webnotes.reload_doc("setup", "doctype", "price_list")
-	webnotes.reload_doc("setup", "doctype", "item_price")
+	webnotes.reload_doc("stock", "doctype", "price_list")
+	webnotes.reload_doc("stock", "doctype", "item_price")
 	webnotes.reload_doc("stock", "doctype", "item")
 	
 	webnotes.conn.sql("""update `tabItem Price` set parenttype='Price List',