Composing recordsets
Recordsets support some additional operations. We can check whether a record is included or not in a recordset. If x
is a singleton recordset and my_recordset
is a recordset containing many records, we can use the following:
x in my_recordset
x not in my_recordset
The following operations are also available:
recordset.ids
 returns the list with the IDs of the recordset elements.recordset.ensure_one()
 checks whether it's a single record (singleton); if it's not, aValueError
exception is raised.recordset.filtered(func)
 returns a filtered recordset, andÂfunc
can be a function or a dot-separated expression representing a path of fields to follow, as shown in the examples that follow.recordset.mapped(func)
 returns a list of mapped values. Instead of a function, a string of text can be used for the name of the field to map.recordset.sorted(func)
 returns an ordered recordset. Instead of a function, a string of text can be used for the name of the field to sort by. An optionalreverse...