Hello experts!
Now, I tried to call a method from js to .py and an error shows.
This is the code in javascript:
frappe.ui.form.on("Sales Invoice", {
refresh: function(frm) {
if(frm.doc.docstatus === 1){
frm.add_custom_button(__('Ready'), function () {
frappe.call({
method:"customapp.tasks.api.reporting",
arg:{
'nameEmployee': frm.doc.nameEmployee
},
callback: function(r){
frm.refresh()
}
})
});
}
}});
And this is the python code:
def reporting(nameEmployee):
link = 'https://websitename/'
header = {
"Accept": "application/json",
"Content-Type": "application/json",
}
data = {
'nameEmployee': nameEmployee,
}
response = requests.post(link ,headers=header, data=data)
frappe.msgprint( response.status_code)
And this is the error:
TypeError: reporting() missing 1 required positional argument: 'nameEmployee'
What I’ve been miss?