Hello i am trying to fetch data from child table to another but it is not working with me
i want to fetch the “qty” field value in sales order item table at sales order doctype
to “qty_order” field delivery note item table at delivery note doctype but it not working can you help me in this
this is my code
frappe.ui.form.on(“Delivery Note”, {
on_load: function(frm) {
if(frm.doc.sales_order) {
frm.doc.items.forEach(function(dn_item) {
var sales_order_item = dn_item.sales_order_item;
if(sales_order_item) {
frappe.model.with_doc("Sales Order Item", sales_order_item, function() {
var so_item = frappe.model.get_doc("Sales Order Item", sales_order_item);
var qty = so_item.qty;
frappe.model.set_value(
"Delivery Note Item",
dn_item.name,
"qty_ordered",
qty
);
});
}
});
frappe.run_serially(function() {
frm.refresh();
});
}
}
});