Another Doctype CRUD Operation

Hi every one,
How can i save Other Doctype data from any other Doctype
I want to save or insert my Doctype(“Flat Invoice”) data in “Sales Invoice” while pressing save button of my Doctype …!
It means when i have press save button in my Flat Invoice…the same entry i want to store in Sales Invoice table…!

Ex: My Doctyep(Flat Invoice) this doctype fields are customer_name=“Deep”,net_amount=“100000”
After press save button…this field data should store in 'Sales Invoice" table
So i can perform all these operation
save,on_submit(),on_cancel(),Amend()

How can i…? Please share the code or example
Because have done by Sql query but that is not good

use

   si =  frappe.get_doc({
        "doctype": "Sales Invoice",
        "items": [{
               "item_code" : "",
       }],
       "net_total": "",
    }).insert()

   si.submit()

Thanks @saurabh6790…I’ll check

@DNGupta you should try something before asking.

Oo sorry for that :blush: @rmehta actually i tried through SQL statements so that was successfully. But that was not good because in some case that code will gives problem…After that i had tried with

frappe.get_doc(“Doctype” ,self.name); but by this i got error…! That’s why i posted