[files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup
diff --git a/hr/doctype/employee/employee.py b/hr/doctype/employee/employee.py
index 16ecb6d..4100e2e 100644
--- a/hr/doctype/employee/employee.py
+++ b/hr/doctype/employee/employee.py
@@ -100,18 +100,20 @@
if self.doc.gender:
profile_wrapper.doc.gender = self.doc.gender
- if self.doc.image and self.doc.file_list:
- # add to file list and user_image
- for file_args in self.doc.file_list.split("\n"):
- fname, fid = file_args.split(",")
- if self.doc.image == fname:
- new_file_args = fname + "," + fid
- file_list = cstr(profile_wrapper.doc.file_list).split("\n")
- if new_file_args not in file_list:
- file_list += [new_file_args]
- profile_wrapper.doc.file_list = "\n".join(file_list)
- profile_wrapper.doc.user_image = fname
- break
+ if self.doc.image:
+ if not profile_wrapper.doc.user_image == self.doc.image:
+ profile_wrapper.doc.user_image = self.doc.image
+ try:
+ webnotes.doc({
+ "doctype": "File Data",
+ "file_name": self.doc.image,
+ "attached_to_doctype": "Profile",
+ "attached_to_name": self.doc.user_id
+ }).insert()
+ except webnotes.DuplicateEntryError, e:
+ # already exists
+ pass
+ break
profile_wrapper.save()
diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py
index 1f288c1..a9a3cf9 100644
--- a/patches/april_2013/p05_update_file_data.py
+++ b/patches/april_2013/p05_update_file_data.py
@@ -2,11 +2,13 @@
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)
diff --git a/patches/april_2013/p06_update_file_size.py b/patches/april_2013/p06_update_file_size.py
new file mode 100644
index 0000000..e61c060
--- /dev/null
+++ b/patches/april_2013/p06_update_file_size.py
@@ -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)
+
+
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index b827c5b..d5b62e3 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -241,4 +241,6 @@
"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",
]
\ No newline at end of file
diff --git a/setup/page/setup/setup.js b/setup/page/setup/setup.js
index 4ab7578..b47f6f2 100644
--- a/setup/page/setup/setup.js
+++ b/setup/page/setup/setup.js
@@ -82,6 +82,12 @@
label: wn._("Rename Tool"),
"description":wn._("Rename multiple items in one go")
},
+ {
+ "route":"List/File Data",
+ doctype: "File Data",
+ label: wn._("File Manager"),
+ "description":wn._("List, delete uploaded files.")
+ },
]
},
{
diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.txt b/stock/doctype/stock_reconciliation/stock_reconciliation.txt
index 760620b..9b5b2a1 100644
--- a/stock/doctype/stock_reconciliation/stock_reconciliation.txt
+++ b/stock/doctype/stock_reconciliation/stock_reconciliation.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-26 06:51:17",
+ "creation": "2013-03-28 10:35:31",
"docstatus": 0,
- "modified": "2013-03-26 08:32:03",
+ "modified": "2013-04-10 13:44:19",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -52,6 +52,7 @@
"fieldname": "posting_date",
"fieldtype": "Date",
"in_filter": 0,
+ "in_list_view": 1,
"label": "Posting Date",
"oldfieldname": "reconciliation_date",
"oldfieldtype": "Date",
@@ -63,6 +64,7 @@
"fieldname": "posting_time",
"fieldtype": "Time",
"in_filter": 0,
+ "in_list_view": 1,
"label": "Posting Time",
"oldfieldname": "reconciliation_time",
"oldfieldtype": "Time",
@@ -148,6 +150,7 @@
"fieldname": "stock_value_difference",
"fieldtype": "Currency",
"hidden": 1,
+ "in_list_view": 1,
"label": "Stock Value Difference",
"print_hide": 1
},