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

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


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


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” ,; but by this i got error…! That’s why i posted