Using the RPC API
One of Odoo's strengths is its interoperability, which is helped by the fact that basically any functionality is available via JSON-RPC 2.0 and XMLRPC. In this recipe, we'll explore how to use both of them from client code. This interface also enables you to integrate Odoo with any other application. Making functionality available via any of the two protocols on the server side is explained in the There's more section of this recipe.
We'll query a list of installed modules from the Odoo instance, so that we could show a list like the one displayed in the previous recipe in our own application or website.
How to do it…
The following code is not meant to run within Odoo, but as simple scripts:
- First, we query the list of installed modules via XMLRPC:
#!/usr/bin/env python2 import xmlrpclib db = 'odoo9' user = 'admin' password = 'admin' uid = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/2/common')\ ...