Accessing data on recordsets
Once we have a recordset, we want to inspect the data contained in it. In the following sections, we will explore how to access data in recordsets.
We can get field values for individual records, called singletons. Relational fields have special properties, and we can use dot-notation to navigate through linked records. Finally, we have some considerations on handling date and time records and converting them between different formats.
Accessing data on records
The special case of a recordset with only one record is called a singleton. Singletons are still a recordset and can be used wherever a recordset is expected.
But unlike multi-element recordsets, singletons can access their fields using the dot-notation, like this:
>>> print(self.name)
OdooBot
In the next example, we can see the same self
singleton recordset also behaves as a recordset, and we can iterate it. It has only one record, so only one name is printed out:
>>> for rec in self:
...