Hi,
I feel I must be missing something obvious here. I have a custom app called email_digest, and inside of it is this simple python script:
#Embedded file name: /home/erpnext/frappe-bench/apps/email_digest/email_digest/send_sms.py
import sys, frappe, messagebird
from frappe import sendmail
@frappe.whitelist()
def fire():
client = messagebird.Client('live_CodeGoesHere')
msg = client.message_create('FromName','0741234567','This is a test', {'test' : True})
This script works with bench execute email_digest.send_sms.fire
The script has also been added to email_digest.egg-info/SOURCES.txt
It’s whitelisted in the same way as other scripts I’ve seen in ERPNext.
I have a custom script which goes as follows:
frappe.ui.form.on("DoctypeNameHere", "refresh", function(frm) {
frm.add_custom_button(__("Send SMS"), function() {
frappe.email_digest.send_sms.fire;
});
});
When pressing the button, I get this error in my browser console:
TypeError: frappe.email_digest is undefined
What am I doing wrong? Why can I not fire this python script from javascript?
Once I get this working, I can easily customize it with arguments containing the variables I need on both the python and javascript ends, I’m just trying to get a very basic form functional. Am I calling it wrong from Javascript, do I need to do something more in Python, or is it something else entirely?