function.js:12 Uncaught (in promise) ReferenceError: frappe is not defined
at function.js:12
at new Promise ()
at Object.list (function.js:10)
at HTMLTableCellElement. (index.js:4)
at HTMLTableElement.dispatch (jquery-3.4.1.slim.min.js:2)
at HTMLTableElement.v.handle (jquery-3.4.1.slim.min.js:2)
What frappe function are you trying to use? If it can be done with jQuery or plain javascript do it that way.
return new Promise(function (resolve, reject) {
try {
frappe.call({
method: 'frappe.client.get_list',
args: {
doctype: opts.doctype,
fields: opts.fields,
filters: opts.filters,
order_by: opts.order_by,
limit_start: opts.limit_start,
limit_page_length: opts.limit_page_length,
parent: opts.parent
},
callback: resolve
});
} catch (e) { reject(e); }
});
This frappe function I am trying to call from this path
/home/frappe/frappe-bench/apps/xyz/xyz/www/cart/js
can you try using above. It uses $.ajax instead of frappe.call. make a whitelisted custom function, allow_guest = True on the python side to return your list.
1 Like