ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

How to create and route a document without save?


#1

How can I create and route to a new document which is not saved?

Like when we make a Sales Order using Quotation doc, we are redirected to a ‘New Sales Order #’, but I don’t want to fill it.
So, how can I redirect to that kind of doctype which don’t have a docname?


#2

I think frappe.model.make_new_doc_and_get_name is what you’re looking for.


#3

Thank you very much @tmatteson , follow the entire code if someone need it:

frappe.ui.form.on('SomeDocType', function() {
    some_trigger: function () {
		local_docname = frappe.model.make_new_doc_and_get_name('Quotation')
		frappe.set_route('Form', 'Quotation', local_docname)
    }
});