mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 03:09:09 +00:00
[files] [cleanup/redesign] removed the old file_list structure and also added file listing in setup
This commit is contained in:
@@ -100,18 +100,20 @@ class DocType:
|
||||
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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user