Merge pull request #21629 from anandbaburajan/attach_multiple_files_to_document_fix

This commit is contained in:
Suraj Shetty 2023-07-11 14:16:03 +05:30 committed by GitHub
commit 9a035864d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -308,7 +308,7 @@ def attach_files_to_document(doc: "Document", event) -> None:
# we dont want the update to fail if file cannot be attached for some reason
value = doc.get(df.fieldname)
if not (value or "").startswith(("/files", "/private/files")):
return
continue
if frappe.db.exists(
"File",
@ -319,7 +319,7 @@ def attach_files_to_document(doc: "Document", event) -> None:
"attached_to_field": df.fieldname,
},
):
return
continue
unattached_file = frappe.db.exists(
"File",
@ -341,7 +341,7 @@ def attach_files_to_document(doc: "Document", event) -> None:
"attached_to_field": df.fieldname,
},
)
return
continue
file: "File" = frappe.get_doc(
doctype="File",