Need to fetch Purchase Order items in Stock Entry Document

Hi all,

I need to fetch Purchase order items in stock entry document’s print format. Anyone please help me.

Thanks,
Aravind.

Maybe kickstart with what docs, threads etc have you tried, share your code and so on?

Hi Clarkej,

Here is my code,
frappe.ui.form.on(‘Stock Entry’, { refresh: function(frm) {
if (frm.doc.purpose == “Subcontract”) {
frm.doc.items.forEach((data) => {
console.log(“data”, data);
if (data.item_code) {
frappe.db.get_value(‘Purchase Order Item’, { name: frm.doc.purchase_order }, ‘purchase_order_item’, ® => {
console.log(“r”, r);
});
}
})
}
}
})

Thanks.