on button click Button

Where i can find the button function for adding{{ method
where i can find the method in the source code to add a call to my API when the button got clicked in Sales Order

Simple example:

For more reference, check the sales_order.js, and find it.

But i have added the custom button already

Create Serial No

frappe.ui.form.on('Sales Order', {
    custom_create_serial_no: function(frm) {{
        method: "My method",
        args: {
            "name": frm.customer
        callback: function(response) {
            if (response.message) {
                frappe.msgprint("Serial No created Successfully");
            } else {
                frappe.msgprint("Serial No created failed.");

do this work

Yes, also works