Hello,
I need to make a button on my “action” doctype which saves the form (i.e. the current doctype) and update the workflow status.
I created the button (called “done”) and I’m able to print message or update fields with it. But I can’t figure out how to save the doctype and update the workflow status. I tried two things but none works:(
-
Write a server script in the .py file of the “action” doctype and call the method from js
My .py code:@frappe.whitelist()
def done():
doc = frappe.get_doc(json.loads(frappe.form_dict.doc))
set_local_name(doc)
doc.save()
My .js code:cur_frm.cscript.done = function(doc) {
cur_frm.call({
method: “done”,
args: { }
});
} -
Call the savedocs method which is define in “frappe-bench/apps/frappe/frappe/desk/form/save.py” in my .js script:
cur_frm.cscript.done = function(doc) {
cur_frm.call({
method: “frappe/frappe/desk/form/save.savedocs”,
args: { }
});
}
This option is obviously better if it works.
Anyone could put me on the right path here?
Thx!