I have installed Whatsapp module from frappe_whatsapp/frappe_whatsapp at master · shridarpatil/frappe_whatsapp · GitHub and want to have a custom button in sales invoice Send Whatsapp Alert for that I am using this code in scipt.
frappe.ui.form.on('Sales Invoice', {
refresh(frm) {
frm.add_custom_button("Send Invoice", function(){
whatsapp(send_invoice);
}, "Send Whatsapp Alert");
}
});
// whatsapp function
function whatsapp(send_invoice)
{
doc = frappe.get_doc('Sales Invoice', 'name');
frappe.get_doc(
'WhatsApp Notification',
'WN-0001'
).send_scheduled_message(doc);
}
It is throwing following error.
### App Versions
{
"erpnext": "16.0.0-dev",
"frappe": "16.0.0-dev",
"frappe_whatsapp": "0.0.2",
"hrms": "16.0.0-dev",
"india_compliance": "16.0.0-dev",
"payments": "0.0.1",
"webshop": "0.0.1"
}
Route
Form/Sales Invoice/SL/2023-24/0477
Traceback
Traceback (most recent call last):
File "apps/frappe/frappe/app.py", line 110, in application
response = frappe.api.handle(request)
File "apps/frappe/frappe/api/__init__.py", line 49, in handle
data = endpoint(**arguments)
File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
return frappe.handler.handle()
File "apps/frappe/frappe/handler.py", line 49, in handle
data = execute_cmd(cmd)
File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "apps/frappe/frappe/__init__.py", line 1783, in call
return fn(*args, **newargs)
File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
return func(*args, **kwargs)
TypeError: get_value() missing 1 required positional argument: 'fieldname'
Request Data
{
"type": "GET",
"args": {
"doctype": "WhatsApp Notification",
"filters": "{\"event_frequency\":{\"isTrusted\":true}}"
},
"headers": {},
"error_handlers": {},
"url": "/api/method/frappe.client.get_value",
"request_id": null
}
Response Data
{
"exception": "TypeError: get_value() missing 1 required positional argument: 'fieldname'",
"exc_type": "TypeError"
}
please help me on this.