[patch] [file data] patch for custom fields with name file_list
This commit is contained in:
parent
457cd7d1f4
commit
e5a36a287f
@ -5,10 +5,22 @@ def execute():
|
|||||||
webnotes.reload_doc("core", "doctype", "file_data")
|
webnotes.reload_doc("core", "doctype", "file_data")
|
||||||
webnotes.reset_perms("File Data")
|
webnotes.reset_perms("File Data")
|
||||||
|
|
||||||
singles = webnotes.conn.sql_list("""select name from tabDocType
|
singles = get_single_doctypes()
|
||||||
where ifnull(issingle,0)=1""")
|
|
||||||
for doctype in webnotes.conn.sql_list("""select parent from tabDocField where
|
for doctype in webnotes.conn.sql_list("""select parent from tabDocField where
|
||||||
fieldname='file_list' and fieldtype='Text'"""):
|
fieldname='file_list' and fieldtype='Text'"""):
|
||||||
|
update_file_list(doctype, singles)
|
||||||
|
|
||||||
|
webnotes.conn.sql("""delete from tabDocField where fieldname='file_list'
|
||||||
|
and parent=%s""", doctype)
|
||||||
|
|
||||||
|
# export_to_files([["DocType", doctype]])
|
||||||
|
|
||||||
|
def get_single_doctypes():
|
||||||
|
return webnotes.conn.sql_list("""select name from tabDocType
|
||||||
|
where ifnull(issingle,0)=1""")
|
||||||
|
|
||||||
|
def update_file_list(doctype, singles):
|
||||||
if doctype in singles:
|
if doctype in singles:
|
||||||
doc = webnotes.doc(doctype, doctype)
|
doc = webnotes.doc(doctype, doctype)
|
||||||
if doc.file_list:
|
if doc.file_list:
|
||||||
@ -24,10 +36,6 @@ def execute():
|
|||||||
except Exception, e:
|
except Exception, e:
|
||||||
if e.args[0]!=1054: raise e
|
if e.args[0]!=1054: raise e
|
||||||
|
|
||||||
webnotes.conn.sql("""delete from tabDocField where fieldname='file_list'
|
|
||||||
and parent=%s""", doctype)
|
|
||||||
# export_to_files([["DocType", doctype]])
|
|
||||||
|
|
||||||
def update_for_doc(doctype, doc):
|
def update_for_doc(doctype, doc):
|
||||||
for filedata in doc.file_list.split("\n"):
|
for filedata in doc.file_list.split("\n"):
|
||||||
if not filedata:
|
if not filedata:
|
||||||
|
@ -247,4 +247,5 @@ patch_list = [
|
|||||||
"execute:webnotes.reload_doc('Stock', 'DocType', 'Delivery Note Item')",
|
"execute:webnotes.reload_doc('Stock', 'DocType', 'Delivery Note Item')",
|
||||||
"patches.april_2013.p06_default_cost_center",
|
"patches.april_2013.p06_default_cost_center",
|
||||||
"execute:webnotes.reset_perms('File Data')",
|
"execute:webnotes.reset_perms('File Data')",
|
||||||
|
"patches.april_2013.p07_update_file_data_custom_field",
|
||||||
]
|
]
|
Loading…
x
Reference in New Issue
Block a user