April 2016
Beginner to intermediate
400 pages
9h 16m
English
When writing Odoo code, the methods of the current model are available via self. If you need to work on a different model, it is not possible to directly instantiate the class of that model—you need to get a recordset for that model to start working.
This recipe shows how to get an empty recordset for any model registered in Odoo inside a model method.
This recipe will reuse the setup of the library example in the addon module my_module.
We will write a small method in the library.book model searching for all library.members. To do this, we need to get an empty recordset for library.members.
To get a recordset for library.members in a method of library.book, you need to take ...