[fixes][attachment deletion]

This commit is contained in:
Nabin Hait 2013-05-06 11:33:29 +05:30
parent 91b0211a58
commit b780ef5ff3

View file

@ -45,7 +45,7 @@ class DocType():
raise webnotes.DuplicateEntryError
def on_trash(self):
if webnotes.conn.sql("""select count(*) from `tabFile Data`
if self.doc.file_name and webnotes.conn.sql("""select count(*) from `tabFile Data`
where file_name=%s""", self.doc.file_name)[0][0]==1:
path = webnotes.utils.get_path("public", "files", self.doc.file_name)
if os.path.exists(path):