Fetching/searching records through JSON-RPC
In the previous recipe, we saw how you can do authentication through JSON-RPC. In this recipe, we will see how you can fetch the data from the Odoo instance with JSON-RPC.
Getting ready
In this recipe, we will fetch book information with JSON-RPC. Make sure you have installed the my_library
module and that the server is running on http://localhost:8069
.
How to do it...
Perform the following steps to fetch book data from the library.book
model:
- Add the
jsonrpc_fetch_data.py
file. You can place this file anywhere you want because the RPC program will work independently. - Add the following code to the file:
# place authentication and get_json_payload methods (see first jsonrpc recipe) if user_id:     # search for the book's ids     search_domain = ['|', ['name', 'ilike', 'odoo'],     ['name', 'ilike&apos...