Writing a To-Do client application
Let's do something interesting with the Odoo RPC API. We built a simple app for tasks we need to perform. What if users could manage personal tasks directly from their computer's desktop? We will create a command-line (CLI) client application that connects directly to our Odoo server and lets us manage our tasks.
We will split it into two files: one dealing with interactions with the server backend, todo_api.py
, and another dealing with the application's user interface, todo.py
.
Communication layer with Odoo
We will create a class to set up the connection with an Odoo server, and read/write To-Do tasks data. It should expose the basic CRUD methods:
read()
to retrieve task datawrite()
to create or update tasksunlink()
to delete a task
Select a directory to host the application files and create the todo_api.py
file. We can start by adding the class constructor, as follows:
from xmlrpc import client class TodoAPI(): def __init__(self, srv, port, db, user...