Create New Record in another doctype without quick entry , client side js

I want To create new record in other doc type called 'Salary Structure 'based on the doctype called “employee contract” using custom button in" employee contract" doctype ,
I did this in parent doctype but can’t with child table
this the code ,my problem is with in the Doctype contract term that have many rows i want to select some of the row and all Colum field to put in salary child table that on other doctype ,
this code write on employee contract doctype,

data = {
            'doctype': 'Salary Structure',
            '__newname': cur_frm.doc.party_name,
        frappe.db.insert(data).then(data => {
        	frappe.msgprint(__("Salary Structure Created"));

Any Idea,pls

Hi @omar_salama

Seems like you may still need to do a bit of research on custom scripts and specifically inserting documents via custom scripts. I’m sure if you search this forum you’ll find lots of examples