Permission to run Method

I have created a Custom Script and added a button … when I click on the Button with the method it says I have no permission to run … How to allow ?
As you can see the method is called from another path (current custom app)

frappe.ui.form.on(“Sales Order”,“cambio_bna”, function(frm,cdt,cdn) {
alert(“botao”)
frappe.call({
method: “gestoficinas.gestoficinas.doctype.cambios.cambios”,
args: {
“fonte”:“BNA”
},
callback: function(r) {
taxavenda = r.message
alert(taxavenda)
}
});

});

Add frappe.whitelist() in your python before definition of this method

frappe.whitelist()
def cambios():
    \\Your Logic

Hope this helps to solve your issue.

@shreyasp thanks it worked :slight_smile: