How to call a python function not whitelist

I want to extend salary slip functionality so I tried to call get_emp_and_leave_details{
				"method": "",
		args: {
			docs: frm.doc
				} ,
				callback: function (data) {

but it gives me an error:

The resource you are looking for is not available

I know it is not whitelisted. but is there a workaround to call not whitelist function in the custom app?

Since you are building a custom app, can think of making a whitelisted api function and call SalarySlip.get_emp_and_leave_details from there.
In custom app…

def get_emp_and_leave_details(dt, dn)
    doc = frappe.get_doc(dt, dn)
    from import get_emp_and_leave_details
1 Like
$c('runserverobj', { 'method': 'get_emp_and_leave_details', 'docs': doc }, callback);

I haven’t tested it. Hope it helps.

@vijaywm Thank you for your reply but is not working, I tried this before and give this error:

 from import get_emp_and_leave_details
ImportError: No module named

try this{
	doc:frm.doc, // place doc here
	args: {
		// no need for docs: frm.doc here.
	callback:function (r) {

@revant_one I am sorry for the confusion .
I am trying to call get_emp_and_leave_details from custom js doctype, not from salary_slip.js

Thanks @revant_one. That works great. (in a different scenario…not related to hr)

@Mohammed_Redha Did you get it working ? I suppose it can be called from any custom doctype js, within desk.

1 Like

@vijaywm No , it is not working for me :disappointed_relieved:

@vijaywm Thank you so much

I tried without import:

    def get_emp_and_leave_details(self):
        doc = frappe.get_doc(self.doctype,

and working like a charm :sunglasses: