Creating or writing multiple records
If you are new to Odoo development, you might execute multiple queries to write or create multiple records. In this recipe, we will look at how to create and write records in batches.
How to do it...
Creating multiple records and writing on multiple records works differently for each, under the hood. Let's see each of these records one by one.
Creating multiple records
Odoo supports creating records in batches. If you are creating a single record, simply pass a dictionary with the field values. To create records in a batch, you just need to pass a list of these dictionaries instead of a single dictionary. The following example creates three book records in a single create
call:
vals = [{ 'name': "Book1", 'date_release': '2018/12/12', }, { 'name': "Book2", 'date_release...