I have renamed the document of a doctype through python but not able to find a way to redirect automatically to the renamed form view
frappe.set_route('Form', doctype, name)→ redirects to the Form view of the given doctype and document name.- Make sure returns the new name after renaming.
frappe.set_route('Form', doctype, name)
is a JS API. I want to handle the scenario from python.
My function of rename doc
def on_update(self):
if self.pm_number and self.name != self.pm_number:
self.pm_number_created = 1
new_name = frappe.rename_doc(self.doctype, self.name, self.pm_number, merge=False)
Want to redirect to the new desk page automatically
you have to return the new name from python function and redirect it using js frappe.set_route()