diff --git a/frappe/core/doctype/file/file.py b/frappe/core/doctype/file/file.py index e2f4b84027..f6f5da3fe6 100755 --- a/frappe/core/doctype/file/file.py +++ b/frappe/core/doctype/file/file.py @@ -216,6 +216,10 @@ class File(NestedSet): def check_reference_doc_permission(self): """Check if permission exists for reference document""" + if not frappe.db.exists(self.attached_to_doctype, self.attached_to_name): + # document is already deleted before deleting attachment + return + if self.attached_to_name: # check persmission try: