Fetch data in child table and refresh it

Dear all,

Following a discussion here: HOW TO: Fetch Child Tables
I was able to fetch items into the Sales Order Items child table from a custom DocType (an exact copy of Sales Order Items) created for the Address.

Here is my working script:

frappe.ui.form.on('Target DocType', {
    link_to_source: function (frm) {
        if (frm.doc.link_to_source) {
            frm.clear_table('target_table');
            frappe.model.with_doc('Source DocType', frm.doc.link_to_source, function () {
                let source_doc = frappe.model.get_doc('Source DocType', frm.doc.link_to_source);
                $.each(source_doc.source_table, function (index, source_row) {
                    frm.add_child('target_table').column_name = source_row.column_name; // this table has only one column. You might want to fill more columns.
                    frm.refresh_field('target_table');
                });
            });
        }
    },
});

What it seems not to work is the following: When I insert items manually in the Sales Order Item child table a lot of filed of the table are fetched automatically, while when I use the above script to fetch them the filed within the table do not fetch. I need therefore to manually re-submit the item_code(s).

Could you please help?

via GIPHY