Saving a document in python with console

Hey there,

can someone hint me to what I am doing wrong?

I am opening a document server side with (It is a Singleton Doctype)

#get document
doc = frappe.get_doc(“Doctype”,“Docname”)
#change value
doc.fieldname = “new value”
#save value
doc.save()

after this I quit the console with Ctrl + D

The change made is not reflected in the UI when I reload the Page

What is my mistake?

Run frappe.db.commit() as the last command. Frappe usually does this automatically but in the console you have to do it yourself.

2 Likes