Searching/reading records through XML-RPC
In this recipe, we will see how you can fetch the data from an Odoo instance through RPC. The user can access most data, except data that is restricted by the security access control and record rules. RPC can be used in many situations, such as collecting data for analysis, manipulating a lot of data at once, or fetching data for display in another software/system. There are endless possibilities, and you can use RPCs whenever necessary.
We will create a Python program to fetch the book data from the
library.book model. Make sure you have installed the
my_library module and that the server is running on
How to do it...
Perform the following steps to fetch a book's information through RPC:
- Add the
books_data.pyfile. You can place this file anywhere you want because the RPC program will work independently.
- Add the following code to the file:
from xmlrpc import client server_url...