ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

Fetch data from Sales order Item to Production order


#1

Hello dears

I`m trying to fetch data from Sales order Item Table to production order useing the below

frappe.ui.form.on(“Production Order”, “onload”, function(frm) {
frappe.db.get_value(“Sales Order Item”, { name: cur_frm.doc.sales_order_item},
“following_notes1”, function(data){
cur_frm.set_value(“following_notes1”, data.notes); });
});

But im facing that error while im accessing as Administrator and have the full permissions on two doctypes

Any idea about that error ??

Note : above Custom script working well while fetching data from Sales Order Doctype but casing permissions error while trying to fetch data from child table


#2

Any Help !


#3

try this,

frappe.ui.form.on("Production Order", "onload", function(frm) {
frappe.call({
			method: "frappe.client.get_value",
			args: {
				doctype: "Sales Order Item",
				fieldname: "following_notes1",
				filters: { 'name': cur_frm.doc.sales_order_item},
				parent: "Sales Order"
			},
			callback: function(r) {		
				cur_frm.set_value(“following_notes1”, r.message.following_notes1);
			}
		});
});

#4

Thank you so much man . It finally works !!


#5