Try ERPNext Buy Support Partners Foundation

Custom Script - Permission denied on getting Item Default

I am trying to get a specific Item Default doc using custom script, but it’s is returning a message of permission denied. How could I get it?

You don’t have enough permission to access this source. Contact the Administrator to have access

This is the console message:

File “/home/erpnext/erpnext-prod/apps/frappe/frappe/client.py”, line 49, in get
check_parent_permission(parent, doctype)
File “/home/erpnext/erpnext-prod/apps/frappe/frappe/client.py”, line 378, in check_parent_permission
raise frappe.PermissionError
frappe.exceptions.PermissionError

Here is my code:

var doc = retorna_doc();

> function retorna_doc() {
>     var retorno = null;
>     frappe.call({
>         method: "frappe.client.get",
>         args: {doctype: "Item Default",
>                  name: "70ad1dd0",}
>         async: false,
>         callback(r) {
>             if(r.message) {
>                 var doc = r.message;
>                 retorno = doc;
>             }
>         }
>     });
>     
>     return retorno;
> }