ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Refresh document after attaching an image


#1

I am attaching an image to a custom doc type programmatically and reloading the document. It still display the cached document and tried doc.reload() and frappe.ui.toolbar.clear_cache() they both get executed but it doesn’t seem to be clearing the cached image.

Any advise?


#2

I was able to solve this. Adding a random number after the image changes the image version and so it gets refreshed.

var imgSrc= "image.png?v="+ Math.random();

#3