Try ERPNext Buy Support Partners Foundation

Need help for Custom Client script

In my custom app, while fetching value through client script not working, error 404.

Client Script

frappe.ui.form.on('Labour Bill Payment', 'btnload', function(frm) {{
		method: "",
		args: {"item_code":frm.doc.labour},
		callback: function(r) {
		if(r.message) {

Py file

def get_item_details(item_code):
    item = frappe.db.sql("""select lab_mc, lab_type,lab_ma,lab_sc
        from `tabLabour` where name = %s""", item_code, as_dict=1)
    return item.lab_mc

Try by adding [0][0] at the end of the frappe.db.sql()

item = frappe.db.sql(""“select lab_mc, lab_type,lab_ma,lab_sc
from tabLabour where name = %s”"", item_code, as_dict=1)[0][0]

Is that path correct? Try changing it. Maybe “construction.client.get_item_details”.

I tried with adding [0][0]at the end but the result shows in the console as

   at Anonymous function (
   at i (
   at j.fireWith (
   at z (
   at Anonymous function (

yes, Path is correct.

Can you check what you are getting in r.message ?
Also check data returning from query in py file.

@Thangamani_M Please make sure the path of python file(in which your function is defined ) is correct or not
here ‘get_lead_details’ is a function and which is defined in ‘’
method: “erpnext.crm.doctype.lead.lead.get_lead_details”,

Thank you, I got solution

“Thank you, I got solution”

Please do post it here thanks!