When I try to query data from another DocType I get permission error

image

my code:

frappe.call({
    "method": "frappe.client.get_value",
    "async": false,
    args: {
        "async": false,
        doctype: "Sales Order Item",
        fieldname: "item_code",
        filters: {
        so_po_ref: ["=", frm.doc.sales_order_ref]
        }
}

Versions:

ERPNext: v10.1.50-2500 () (staging)

Frappe Framework: v10.1.46-1808 () (staging)

I tried this kind of approach one year ago, but as per the result i conclude that we can’t access child table directly from frappe method. If you still want to access child table directly then you have to use frappe.db.sql() or you can access child table based on parent.

Thanks, found the answer here too Get_value on child table failing with permission error