[fix] [patch] check in_list_view for Custom DocTypes
diff --git a/patches/july_2013/p05_custom_doctypes_in_list_view.py b/patches/july_2013/p05_custom_doctypes_in_list_view.py
new file mode 100644
index 0000000..769e47a
--- /dev/null
+++ b/patches/july_2013/p05_custom_doctypes_in_list_view.py
@@ -0,0 +1,21 @@
+import webnotes
+from webnotes.model import no_value_fields
+
+def execute():
+	for dt in webnotes.conn.sql("""select name from `tabDocType` where custom=1"""):
+		dtbean = webnotes.bean("DocType", dt)
+		
+		if any((df.in_list_view for df in dtbean.doclist.get({"doctype": "DocField", "parent": dt}))):
+			continue
+		
+		i = 0
+		for df in dtbean.doclist.get({"doctype": "DocField", "parent": dt}):
+			if i > 5:
+				break
+			
+			if df.fieldtype not in no_value_fields:
+				df.in_list_view = 1
+				i += 1
+				
+		if i > 0:
+			dtbean.save()
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index d6f4424..7034980 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -252,4 +252,5 @@
 	"patches.july_2013.p03_cost_center_company",
 	"execute:webnotes.bean('Style Settings').save() #2013-07-16",
 	"patches.july_2013.p04_merge_duplicate_leads",
+	"patches.july_2013.p05_custom_doctypes_in_list_view",
 ]
\ No newline at end of file