How to rename sales order ID?

I am trying to rename my sales order ID so that it is the same as the quotation referenced.
This is the client script code I am using:

frappe.ui.form.on('Sales Order', {
    refresh(frm) {
        var quotation = frm.doc.items[0].prevdoc_docname;
        if (!frm.is_new() && quotation &&!==quotation){
            method: 'frappe.model.rename_doc.rename_doc',
            args: {
                doctype: frm.doctype,
                 old: frm.docname,
                "new": quotation,
                "merge": false

However, the result i get is “Method not allowed” as shown below.

How can I solve this problem?