How to reload document's form UI after doctype custom Server Action?

All answers here mentioned calling cur_frm.reload() from JavaScript.

The problem is I’m using custom Server Action in Python.

When I change:

doc = frappe.get_doc(..., ...)
doc.something = somevalue
doc.save()

the doc will not be reflected in UI, until user manually click Reload.

I’ve tried doc.notify_update(), doc.reload(), but still cannot update the UI.

1 Like

Hello
I’m facing the same issue

both python method not work

I have managed to do on server side:
frappe.publish_realtime('new_data', user=frappe.session.user)

And in the js:

frappe.realtime.on(‘new_data’, () => {
frm.reload_doc();
});

Its somewhat dirty, but the internal methods are not actually reloading the UI after server side modification

4 Likes