ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

How to copy one doctype child table to another doctype child table?

I need to copy Request of quotation item child to quotation item child table…Anyone here please help me in this…I am trying a lot way but achieved

frappe.ui.form.on(“Request for Quotation”, {
“refresh”: function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frm.add_custom_button(__(“Quotation”), function() {
frappe.new_doc(‘Quotation’, cur_frm.doc.refresh
)
});
}
});

frappe.ui.form.on("Quotation", {
    "refresh": function(frm, cdt, cdn) {
        if(frm.doc.__islocal && frm.doc.refresh){
        frappe.model.with_doc("Request for Quotation", frm.doc.refresh, function() {
            var mcd = frappe.model.get_doc("Request for Quotation", frm.doc.refresh);
                cur_frm.clear_table("items");
                    $.each(mcd.items, function(i, d) {
                        i = frm.add_child("items");
                        i.item_code = d.item_code;
                        i.item_name = d.item_name;
                        i.uom = d.uom;
                        i.price_list_rate = d.price_list_rate;
                        i.rate = d.rate;
                        i.stock_uom = d.uom;
                        i.description = d.description;
                        i.qty = d.qty;
                        });
                cur_frm.refresh_field("items");
            });
        }
    }
});    

this is not working for me anyone please help .