[Rename Tool] Fixed reading data from wrong file issue

This commit is contained in:
Rohit Waghchaure 2016-08-11 18:54:11 +05:30
parent 92a67b7b78
commit 1fbc271b5d

View file

@ -18,8 +18,10 @@ def read_csv_content_from_uploaded_file(ignore_encoding=False):
return read_csv_content(fcontent, ignore_encoding)
def read_csv_content_from_attached_file(doc):
fileid = frappe.db.get_value("File", {"attached_to_doctype": doc.doctype,
"attached_to_name":doc.name}, "name")
fileid = frappe.get_all("File", fields = ["name"], filters = {"attached_to_doctype": doc.doctype,
"attached_to_name":doc.name}, order_by="creation desc")
if fileid : fileid = fileid[0].name
if not fileid:
msgprint(_("File not attached"))