Try ERPNext Buy Support Partners Foundation

Show Attachment as Image in Form


to connect my document management system with erpnext, I created a doctype called ecoDMS.

If I want to connect the document #21 with e.G. an Invoice, I create a document of the type ecoDMS with the number 21. Over a custom script all the metadata gets imported into the document.
In addition to the metadata, I create a preview of the document, and attach it as a jpg to ecoDMS-document in erpnext.

Now I want to show the attached image.jpg in the form:

So where the ‘missing image’ symbol is shown, the attachment should be displayed.

I do not want the user to upload any attachments. It should only show the page-one preview, that was uploaded via the API on item_creation.

If I use an Attach Image field, and link that to the Image, I can manually select the uploaded file, and it gets displayed.

The file looks like that:

If I manually upload a new picture, the file has an attribute Attached to Field

I found the Parameter in the code, and added it to my Uploaded file.

Still, if I upload the picture, it is not displayed.

I solved it by:
using a hidden ‘Attach Image’ filed, and update its filepath after the image upload.