Working with recordsets
We will now explore how the ORM works and learn about the most common operations performed with it. We will use the prompt provided by the shell
command to interactively explore how recordsets work.
Querying models
With self
, we can only access the method's recordset. But the self.env
environment reference allows us to access any other model. For example, self.env['res.partner']
returns a reference to the Partners model (which is actually an empty recordset). We can then use search()
or browse()
on it to generate recordsets.
The search()
method takes a domain expression and returns a recordset with the records matching those conditions. An empty domain []
will return all records. For more details on domain expressions please ...
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.