When create doctype using mapper this not auto get item name based on item_code

Hello,

when i use frappe mapper to open a sales invoice from a task doctype and sed value item _code, qty, amount but when sales invoice open this set item_code but this not fatch other details.

    function create_sales_invoice(frm){
        frappe.model.open_mapped_doc({
            method: "harness.api.task.make_sales_invoice",
            frm: frm,
        })
    }

python

    @frappe.whitelist()
    def make_sales_invoice(task):
        task = frappe.get_doc("Task", task)
        sales_invoice = frappe.new_doc("Sales Invoice")
    
        if task.custom_materials1:
            for row in task.custom_materials1:
                item_row = sales_invoice.append("items", {})
                item_row.item_code = row.material_item
                item_row.qty = row.quentity
                item_row.rate = row.rate
                item_row.amount = row.amount
                item_row.warehouse = row.source_warehouse
                item_row.target_warehouse = row.target_warehouse
                item_row.sales_order = task.custom_sales_order
    
        if task.custom_resources1:
            for row in task.custom_resources1:
                item_row = sales_invoice.append("items", {})
                item_row.item_code = row.service_item
                item_row.qty = row.spent_hours
                item_row.rate = row.rate
                item_row.amount = row.total_spend_hours
                item_row.warehouse = ""
                item_row.target_warehouse = ""
                item_row.sales_order = task.custom_sales_order
    
        sales_invoice.customer = frappe.db.get_value("Sales Order", task.custom_sales_order, fieldname=["customer"])
        sales_invoice.custom_job_order = task.name
    
        print("sales invoice", frappe.as_json(sales_invoice))
        return sales_invoice

uscase:
add a create sales invoice button on task doctype and when click on it set child table value from task set in sales invoice item table. we only set item code and make sure in sales invoice auto fatch other details like uom, item_name, account etc.