Merge branch 'latest' of github.com:webnotes/erpnext into latest
diff --git a/erpnext/patches/jan_mar_2012/website/domain_list.py b/erpnext/patches/jan_mar_2012/website/domain_list.py
new file mode 100644
index 0000000..fabbdce
--- /dev/null
+++ b/erpnext/patches/jan_mar_2012/website/domain_list.py
@@ -0,0 +1,22 @@
+def execute():
+	import webnotes
+	from webnotes.modules.module_manager import reload_doc
+	reload_doc('website', 'doctype', 'website_settings')
+
+	res = webnotes.conn.sql("""\
+		SELECT name FROM `tabDocPerm`
+		WHERE parent='Website Settings' AND role='All' AND permlevel=1""")
+	if not res:
+		idx = webnotes.conn.sql("""\
+			SELECT MAX(idx) FROM `tabDocPerm`
+			WHERE parent='Website Settings'
+			""")[0][0]
+		from webnotes.model.doc import Document
+		d = Document('DocType', 'Website Settings')
+		perm = d.addchild('permissions', 'DocPerm')
+		perm.read = 1
+		perm.role = 'All'
+		perm.permlevel = 1
+		perm.idx = idx + 1
+		perm.save()
+