Working with the ORM API
From the previous section, we already got a taste of what it is like to use the ORM API. Next we will look at what more we can do with it.
Method decorators
During our journey, the several methods we encountered used API decorators like @api.multi
. These are important for the server to know how to handle the method. Let's recap the ones available and when they should be used.
The @api.multi
decorator is used to handle recordsets with the new API and is the most frequently used. Here self
is a recordset, and the method will usually include a for
loop to iterate it.
In some cases, the method is written to expect a singleton: a recordset containing no more than one record. The @api.one
decorator was deprecated as of 9.0 and should ...
Get Odoo 10 Development Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.