The Library client XML-RPC interface
Let's start with the implementation of out Library client application. We will split it into two files: one dealing with the interface with the server backend, library_api.py
, and another dealing with the application's user interface, library.py
. We will then provide alternative implementation for the backend interface, using the existing library, OdooRPC
.
We will create a class to set up the connection with an Odoo server, and read/write Library Book data. It should expose the basic CRUD methods:
search_read()
to retrieve book datacreate()
to create bookswrite()
to update booksunlink()
to delete a book
Â
Â
Choose a directory to host the application files and create the library_api.py
file. We start by adding the class constructor, as follows:
from xmlrpc import client class LibraryAPI(): def __init__(self, srv, port, db, user, pwd): common = client.ServerProxy( 'http://%s:%d/xmlrpc/2/common' % (srv, port)) self.api = client...