On select link type docfield it redirects me to login page

I am trying to develop a simple dropdown filter based on another. I created both as link type docfield and added js in whitelisted python method. I found my code is properly executing but unfortunately it throwing me to login page saying “You dont have enough permissions to access this resources” logs it out.

I have set I created a role named librarian and assigned to each doctype. Also checked in role permission manager.

Still it throwing me to login page while i select shelf name to filter rag names.

Please help me.

I am sharing few screenshots below:

Thanks in advance.

Use this @frappe.whitelist(allow_guest=True) and see if it works just to be sure there this permission issue.

1 Like

@KanchanChauhan Thanks for your reply. Even After applying @frappe.whitelist(allow_guest=True) it getting me logout. Please suggest if any other issue.

I solved it by:

// On select shelf name filter rag name
frappe.ui.form.on("Book","onload", function(frm) {
    cur_frm.set_query("rag_name",function() {
        return {
            "filters": {
                "shelf_name": frm.doc.shelf_name