Document status is shown as Not Saved


After saving the form, we are changing one of the form field value explicitly using frm.set_value(“current_location”,

I have used jquery autocomplete plugin…so in Database side we are storing id field and on form showing city value. so in after_save trigger setting city name again.

Then it shows Document status as ‘Not Saved’… as we have changed the field value.

How to set Document status as ‘Saved’.?


Try frappe.model.set_value()

frappe.model.set_value("Doctype",, "field_name", "value");

1 Like


Value can be set on the field using frappe.model.set_value, but still Doc status is shown as Not saved…

Any help?

I think this is because your trigger is after_save which runs after the form is saved. Or maybe you have a script that changes something in the form/doctype after the form has been saved.

Once the doctype detects that a field has been changed AFTER it has been saved, it reverts from Saved to Not Saved. If you want to write a value straight to the database, I suggest creating a python method which will execute via

Use frappe.db.sql in your python script to write the data straight to the database instead of saving it via the front end.

Hope this helps.



Many Thanks @littlehera … I can update cityid using frappe.db.sql in python script…in after_save trigger…

While editing record, I have to show City Name again from cityid… and doctype detects that a field has been changed and it reverts from Saved to Not Saved.

Only want to know that actually is it possible to manage this kind of thing in a single field?..where we are storing value in DB which is other than that we are showing on the form…

Will City Name be stored in the UI? Or do you only need it to be shown/visible but it’s not necessary to store it in the db?

You can change City Name to an HTML field which you can change using javascript.

Also, is it necessary for City Name to be set after save? I think it would be better to set City Name once cityid has been set using cur_frm.add_fetch or (if you are coding via js).

This worked for me. Thanks

Hi abhijit,
Please help me set value for selection field options through Python or js
Values need to be updated on db
Pls help me with this