[fix] [patch] check in_list_view for Custom DocTypes
This commit is contained in:
parent
08352ca0a9
commit
55da1ff98a
21
patches/july_2013/p05_custom_doctypes_in_list_view.py
Normal file
21
patches/july_2013/p05_custom_doctypes_in_list_view.py
Normal file
@ -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()
|
@ -252,4 +252,5 @@ patch_list = [
|
||||
"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",
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user