Fetching data from one table to another

Can someone pls help me in fetching data from one table into another. For example in Items doctype I have a table where I can enter Supplier Name, and Item Price (the price at which we buy the item from that particular supplier)

I want to fetch this Item Price in ‘Purchase Order Item’ table inside a Purchase Order. Based on the supplier the respective price should be fetched as rate and total amount should be calculated accordingly.

This is the table where I want to fetch Item Price

Do you have server access?

@tuan_ha No I don’t have server access. Can this not be done through customize forms?

You can try this on your customs script, under Purchase Order Item form:

frappe.ui.form.on(“Purchase Order Item” , {
item_code: function(frm, cdt, cdn){
var d = locals[cdt][cdn]
if (frm.doc.item_code) {
frappe.call({
“method”: “frappe.client.get”,
args: {
doctype: “Item”,
name: d.item_code
},
async: false,
callback: function (data.message) {
$.each(data.message.supplier_items || [], function(i, d){
if (d.supplier == frm.doc.supplier){
frm.model.set_value(cdt, cdn, “item_price”, d.item_price)
}
}
frm.refresh_field(“items”)
}
});
}
}
}