Custom script not working and no clues where to debug

Hi,

I am very new to erpnext and I am trying my hand with writing a custom script. My custom script lives in my own app and it’s a simple script like this:

import frappe

@frappe.whitelist()
def get_custom_issue():
    msgprint("From Py")

I put this script in ~/frappe-bench/apps/myapp. I then customize the built in Issue to have a javascript like this:

cur_frm.cscript.custom_issue = function(doc) {
    alert("From JS");
    cur_frm.call({
       "method": 'myfolder.custom_issue.get_custom_issue',
        callback: function(r) {
        }
    })
};

I have saved and reloaded the site, but then when I create a new Issue, it does not even pop up the alert. I have been looking at the logs on the server plus using web developer on Firefox to prod around to see errors are showing up but I see nothing. Can someone offer some help ? Thanks.

The code executes, on trigger of custom_issue field. When you want to trigger your custom code?

Also instead of cur_frm use

frappe.ui.form.on("Issue", {
    custom_issue : function(){
         // your code
    }
})

either use frappe.msgprint or first import from frappe import msgprint.

If a site is in production, you have to restart supervisor to see the changes made in python.

Thanks!