[patch] [file data] fix

This commit is contained in:
Anand Doshi 2013-04-29 15:27:57 +05:30
parent 28eae6e9ff
commit fe5fb33cc2

View File

@ -56,13 +56,13 @@ def update_for_doc(doctype, doc):
if exists:
if webnotes.conn.exists("File Data", fileid):
try:
fd = webnotes.bean("File Data", fileid)
if not (fd.doc.attached_to_doctype and fd.doc.attached_to_name):
fd.doc.attached_to_doctype = doctype
fd.doc.attached_to_name = doc.name
fd.save()
else:
try:
fd = webnotes.bean("File Data", copy=fd.doclist)
fd.doc.attached_to_doctype = doctype
fd.doc.attached_to_name = doc.name