[DEV] Changes of doctype not reflected in the browser

Hi guys,

I am changing document (instance) server-side and want this change to be reflected after

frappe.set_route(“Form”, “MyDoctype”, “MyDoctypeName”)

is called. For the moment when I change some of the values in the DB they are not updated in the view.
Should I call:


as a callback to set_route?


1 Like

Nobody using set_route or reload_doc? :slight_smile:

For the moment


is not working I will try triggering refresh event or clicking reload in the menu. Actually I find this a very bad solution, I will highly appreciate any tips guys!


call bench --site [sitename] clear-cache

If you change doctype properties from the front end, you don’t need to do that (thats the way it is supposed to be designed)

@rmehta - thank you for the reply.
I am talking about an instance, not a Doctype properties. Let say I am changing one of the ToDo tasks after Customer details update.

However after


The browser still gives me old values. :frowning:
One of the solutions is triggering click on Menu->Reload but I find this solution ugly and error prone.

frm.doc_reload ();

is not working from Save button callback.

It is still not very clear. Can you share the full code snippet?

Below please find snippets

Custom script for My Test Doctype

		args: {
				curDoc: JSON.stringify(frm.doc)
                callback: function(response){
                                  nextDoc = response.messages.nextDoc
                                  nextDocName = response.messages.nextDocName
                                  error = response.messages.error
                                  else if (nextDoc != null && nextDocName != null)
                                             frappe.set_route("Form", nextDoc, nextDocName);
                                             //here I have tried to reload doc - by frm.doc_reload();

Server side logic

def get_next_doc(curDoc):
    retDict = { }
    nextDoc = None
    error = None
    curDoc = json.loads(curDoc)
    curDocName = curDoc.get("name", None)
    activity = curDoc.get("activity", None)
    if curDocName == None:
        error = "error: name field not given"
    elif activity == None:
        error = "error: activity field not given"
        if activity == "Forward":
            nextDoc = "My Next Doctype"
            nextDoc = "My Previous Doctype"
        create_next_doc(nextDoc, curDocName, activity)
        retDict['curDocName'] = curDocName
        retDict['nextDoc'] = nextDoc
    retDict['error'] = error
    return retDict
def create_next_doc(doctype, curDocName, activity):
    doc = None
    if frappe.db.exists(doctype, curDocName):
        doc = frappe.get_doc(doctype, curDocName)
        doc.activity_status = activity
        doc.flags.ignore_mandatory = True
        doc = frappe.get_doc({
            "doctype" : doctype,
            "doc_name" : curDocName,
            "activity_status" : activity
        doc.flags.ignore_mandatory = True

The thing is that when I update My Test Doctype and move to Next or Previous Doctype the value is not udpated for activity_status.
It is updated in the DB because when I refresh via F5 or click on Reload in Menu it is getting proper values.
That’s why I have tried frm.doc_reload() or triggering click.


Not sure if this is relevant but I am getting this error on socket.io on my developer server:

UPDATE: Fixed above issue (not relevant).

Of course I am getting this when moved to next document:

Error: Document has been modified after you have opened it (2016-08-04 15:46:27.622740, 2016-08-04 15:46:44.403341). Please refresh to get the latest document.

Looks like when I insert or update document for 1st time in particular browser tab the frontend “knows” it has changed.
When in the SAME “seesion” (without reload / refresh) I change values in the backend I get this error.

I have seen many post and issues like this and ERPNext unable to awnser them and some time dont know what to say and some time they dont understand what we need. Are they realy professionals? is frappe realy done by people like? @rmehta
Many posts are disappointing.

1 Like

Use window.location.reload(); instant of frm.doc_reload may be it helps

1 Like

@mtajammul this is a free, volunteer-supported forum. The people answering here volunteer their time and energy for the good of the community.

If you are not happy with the completely free support people do their best to voluntarily provide, please take the step to pay for developer support with an SLA from a service provider. That’s the best advice I can give to help you achieve your goals.

I’m closing this thread for now. If more help is needed, please start another thread.