Rename Buttons in Form View

In a submitted Sales Order, you can see multiple options under the 'Create' option:

Custom Script

You can use this custom script to rename the buttons:

frappe.ui.form.on('Sales Order', {
    on_submit: function(frm){
    //  console.log('reloaded doc on submit')
    onload_post_render: function(frm){
        var bt = ['Delivery', 'Work Order', 'Invoice', 'Material Request', 'Request for Raw Materials', 'Purchase Order', 'Payment Request', 'Payment', 'Project', 'Subscription']
  , 'Create')
            });'Order Raw Materials', () => cur_frm.cscript.make_raw_material_request(), 'Create')

Using this script, we have removed/hidden the unwanted buttons, and then renamed one:

Custom Script

Note: To learn more about the JS APIs, visit the frappe documentation.

To check the method which is called, you will need to check JS file for that doctype. In this example, for renaming 'Request For Raw Materials', we are referring to this line.

Was this article helpful?