Refresh document after attaching an image

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?

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();
1 Like