Enable Make Menu for Custom doctype

Dear all
I have a custom doctype named “Special Order”, I want this special order to be converted to RFQ.
what I need is: when “Special Order” submits Make menu should apear at the top right of the page like when you submit a Sales order.

Thank you

Hi @zia,

add this to your JavaScript file:

refresh: function(frm) {
  if (frm.doc.docstatus == 1) {
    // add utility buttons
    frm.add_custom_button(__("Function name"), function() {
        /* your code here */
    }, __("Make"));
  }
} 

Hope this helps.

Dear @lasalesi I past the code in custom script and replaced the “Function Name” with “RFQ” . when I refresh the page syntax error poping up.
but if I past the above code like bellow then nothing happens

frappe.ui.form.on(“Special Order”, {
refresh: function(frm) {
if (frm.doc.docstatus == 2) {
// add utility buttons
cur_frm.add_custom_button(__(“rfq”), function() {
/* your code here */
}, __(“Make”));
}
}
});

Sorry, the docstatus == 1 is submitted :wink: Then it should work…

thank you @@lasalesi it shows now

When I click on item menu “Request For Quotation” I want to be redirected to request for quotation page with list of items which I have in special orders.
could you please help me how?
I’m very thankful of your help