-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Odoo 14 Development Cookbook
By :

When writing Odoo code, the methods of the current model are available through 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 you how to get an empty recordset for any model that's registered in Odoo inside a model method.
This recipe will reuse the setup of the library example in the my_library
add-on module.
We will write a small method in the library.book
model and search for all library.members
. To do this, we need to get an empty recordset for library.members
. Make sure you have added the library.members
model and access rights for that model.
To get a recordset for library.members
in a method of library.book
, you need to perform the following steps:
LibraryBook
class, write a method called get_all_library_members
...