Hi!
If I generate a file on the server in Python, how can I store and attach this file to an existing document?
Is there any utility function for this in frappe?
Thanks!
DoCa
Hi!
If I generate a file on the server in Python, how can I store and attach this file to an existing document?
Is there any utility function for this in frappe?
Thanks!
DoCa
@doca, did you ever find a solution for this? I also have some File docs that I have created and I would like to attach these Files to other documents using Python.
The File DocType has two fields called attached_to_doctype
and attached_to_name
.
So let’s say you want to attach a file to a Customer. You’d do it like this:
file = frappe.get_doc("File", "4ab1a860dc")
file.attached_to_doctype = "Customer"
file.attached_to_name = "John"
file.save()
Thank you, cryptopunk!