When working with a recordset of length 1, the various fields are available as record attributes. Relational attributes (One2many, Many2one, and Many2many) are also available with values that are recordsets too. When working with recordsets with more than one record, the attributes cannot be used.
This recipe shows you how to use the mapped() method to traverse recordset relations; we will write two methods performing the following operations:
- Retrieving the emails of all contacts of one or more companies passed as an argument
- Retrieving the various companies to which some contact partners are related