Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

Fetch Doctype details in "Advance Cash Payment Request"

Hi,

I need to fetch the Doctype at Advance Cash Payment Request if I go through the Doctype (like PO it should automatically fetch that particular PO details with the amount and same for the Vehicle fuel Price and all Doctype details belong to that.

I was trying in custom script like this:

frappe.ui.form.on(‘Advance Cash Request Form’, {
refresh(frm) {
// your code here
}
});
frappe.ui.form.on(“AD”, “onload”, function(frm) {
if (doctype = “Purchase Order”)
then;
frappe.db.get_value(“Purchase Order”, { name: cur_frm.doc.naming_series},
“field”, function (supplier){
cur_frm.set_value(“field”, “data.field”); });
});

BUT I RECEIVED AN ERROR OF:

SyntaxError: Invalid or unexpected token
    at init.setup (http://172.158.0.23:82/assets/js/form.min.js?ver=1619480620.0:1:640004)
    at frappe.ui.form.Form.setup (http://172.158.0.23:82/assets/js/form.min.js?ver=1619480620.0:1:687070)
    at frappe.ui.form.Form.refresh (http://172.158.0.23:82/assets/js/form.min.js?ver=1619480620.0:1:690158)
    at frappe.views.FormFactory.load (http://172.158.0.23:82/assets/js/form.min.js?ver=1619480620.0:1:592361)
    at http://172.158.0.23:82/assets/js/form.min.js?ver=1619480620.0:1:592087
    at http://172.158.0.23:82/assets/js/desk.min.js?ver=1619480620.0:1:139904
    at new Promise ()
    at Object.with_doc (http://172.158.0.23:82/assets/js/desk.min.js?ver=1619480620.0:1:139657)
    at frappe.views.FormFactory.show_doc (http://172.158.0.23:82/assets/js/form.min.js?ver=1619480620.0:1:592016)
    at frappe.views.FormFactory.make (http://172.158.0.23:82/assets/js/form.min.js?ver=1619480620.0:1:591187)