This topic has been brought up several times. The question of how to pull a child table from one form to another using a custom script. This is not working for me so far:
Current Document Details
Source DocType: QuoteMaster
Source Child Table Field Name: items
Source Child Table DocType: BOM Item
Target DocType: Sales Order
Target Link Field: quotemaster
Target Child Table Field Name: qm_items
Target Child Table DocType: BOM Item
Current Custom Script:
frappe.ui.form.on("Sales Order", "quotemaster", function(frm) {
frappe.model.with_doc("QuoteMaster", frm.doc.quotemaster, function() {
d = frm.add_child("qm_items");
quotemaster.items.forEach(function(row){
d.item_code = row.item_code;
d.qty = row.qty;
});
});
cur_frm.refresh_field("qm_items");
});
Currently, this does not pull any items from the QuoteMaster table. However, on save a blank line is added to the Sales Order Table.
@max_morais_dmm