Fetch Project Task into BOM Operation

Hi There.

I want to get Project Task to show in BOM Operation table with customized Operations Child table.
The process is when open a BOM from a Project then on Enable with Operations then a button can import the Project Tasks into the Operation child table predefinied field.

I got this for fetch data:

frappe.ui.form.on("BOM", {
onload: function(frm) {
    frappe.model.with_doc("Project", frm.doc.onload, function() {
        var tabletransfer= frappe.model.get_doc("Project Task", frm.doc.onload)
        $.each(tabletransfer.[tasks, function(index, row){
            d = frm.add_child("BOM Operation");
            d.task = row.title;
            d.employee = row.employee;
            frm.refresh_field("BOM Operation");


I have extended the Peoject Tasks to look like this.

I got extended the BOM Operations table

And I want to import it on BOM open or refresh… or else.

Import to here:

Is it correct for a custom script?

Please let me know.

Thank you.