How To auto fatch child table value in new doctype?


i create a doctype called job and add a child table for item_code, qty, rate and amount i put a custom button to create a stock entry and auto fatch job child table data to stock entry.

when i click on this button is send this data to stock enry but when i click on save button on stock entry its show a mandetory fields error. we need to auto fatch this when create stock entry this work on default. please how can i solved this ?

we are using frappe.model to do this

function create_stock_entry(frm){{
      method: "harness.api.task.create_stock_entry",
      args: {
          docname: frm.docname
      callback: function(response) {
          frappe.model.with_doctype("Stock Entry", function() {
              var tasks = response.message; // response contains child table data of JOB
              // Create a new Stock Entry
              var stock_entry = frappe.model.get_new_doc("Stock Entry");

              // Iterate over tasks data and add rows to Stock Entry's items table
              $.each(tasks, function(index, task) {
                  var item_row = frappe.model.add_child(stock_entry, "Stock Entry Detail", "items");
                  frappe.model.set_value(item_row.doctype,, 's_warehouse', task.s_warehouse);
                  frappe.model.set_value(item_row.doctype,, 't_warehouse', task.t_warehouse);
                  frappe.model.set_value(item_row.doctype,, 'item_code', task.item_code);
                  frappe.model.set_value(item_row.doctype,, 'qty', task.qty);
                  frappe.model.set_value(item_row.doctype,, 'basic_rate', task.basic_rate);
                  frappe.model.set_value(item_row.doctype,, 'basic_amount', task.basic_amount);
                  frappe.model.set_value(item_row.doctype,, 'custom_job_order', task.custom_job_order);

                  // Refresh the child table field
              frappe.model.set_value(stock_entry.doctype,, 'stock_entry_type', 'Material Transfer for Manufacture');

              frappe.ui.form.make_quick_entry('Stock Entry', null, null, stock_entry);