mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 11:49:10 +00:00
[files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup
This commit is contained in:
@@ -2,11 +2,13 @@ import webnotes, webnotes.utils, os
|
||||
from webnotes.modules.export_file import export_to_files
|
||||
|
||||
def execute():
|
||||
webnotes.reload_doc("core", "doctype", "file_data")
|
||||
webontes.reset_perms("File Data")
|
||||
|
||||
singles = webnotes.conn.sql_list("""select name from tabDocType
|
||||
where ifnull(issingle,0)=1""")
|
||||
for doctype in webnotes.conn.sql_list("""select parent from tabDocField where
|
||||
fieldname='file_list' and fieldtype='Text'"""):
|
||||
print doctype
|
||||
if doctype in singles:
|
||||
doc = webnotes.doc(doctype, doctype)
|
||||
update_for_doc(doctype, doc)
|
||||
|
||||
11
patches/april_2013/p06_update_file_size.py
Normal file
11
patches/april_2013/p06_update_file_size.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import webnotes, os, webnotes.utils
|
||||
|
||||
def execute():
|
||||
files_path = webnotes.utils.get_path("public", "files")
|
||||
for f in webnotes.conn.sql("""select name, file_name from
|
||||
`tabFile Data`""", as_dict=True):
|
||||
filepath = os.path.join(files_path, f.file_name)
|
||||
if os.path.exists(filepath):
|
||||
webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size)
|
||||
|
||||
|
||||
@@ -241,4 +241,6 @@ patch_list = [
|
||||
"patches.april_2013.p04_reverse_modules_list",
|
||||
"execute:webnotes.delete_doc('Search Criteria', 'time_log_summary')",
|
||||
"patches.april_2013.p04_update_role_in_pages",
|
||||
"patches.april_2013.p05_update_file_data",
|
||||
"patches.april_2013.p06_update_file_size",
|
||||
]
|
||||
Reference in New Issue
Block a user