Creating new docs

Continuing the discussion from Doctype form explanation:

To insert new docs, use frappe.get_doc and insert

Never use frappe.db.sql

Read this:

https://frappe.io/kb/app-development/insert-a-document-via-api

Hi,

Thanks, this very useful, any way using insert i dont need to put the name , creted date, etc (columns that not defined in doctype but auto generated by frappe) right ?

Thanks

Yes…
Name, creation_date, created_by, modified_by etc will be added automatically by the system via insert() function.