December 2018
Beginner to intermediate
404 pages
10h 14m
English
Recordsets implement the active record pattern. This means that we can assign values to them, and these changes will be made persistent in the database. This is an intuitive and convenient way to manipulate data, but only works with one field and one record at a time.
Here is an example:
>>> root = self.env['res.users'].browse(1) >>> print(root.name) OdooBot >>> root.name = 'Superuser' >>> print(root.name) Superuser
While using the active record pattern, the value of relational fields can be set by assigning a recordset.
For many-to-one fields, the value assigned must be a single record (a singleton recordset).
For to-many fields, the value can also be assigned with a recordset, replacing the list ...
Read now
Unlock full access