Hi, I’m trying to make that when I rename a document, it takes me to a new location. I haven’t found a way to change the name on the client side without ignoring permissions.
How to route client after rename custom doc?
What i do:
Server Script:
if "Sprawdzenie Laptopa" in doc.typ_uslugi:
new_name = doc.new_name
frappe.rename_doc(doc.doctype, doc.name, new_name, False, False, True)
Custom doctype Client Script:
frappe.ui.form.on("Wykonanie Uslugi", {
before_submit: function(frm){
var new_name = frm.docname+"-01";
frm.set_value("new_name", new_name);
setTimeout(function(){
frappe.set_route('Form', frm.doctype, new_name);
}, 2000);
console.log(frm.doc.new_name);
}
});