OdooRPC Client

raw JSON →
0.10.1 verified Mon Apr 27 auth: no python

OdooRPC is a Python package providing an easy way to pilot your Odoo servers through RPC. It supports Odoo versions 8.0 through 17.0+ and handles authentication, model operations, and RPC calls. Current version: 0.10.1. Release cadence: irregular, maintained by OCA.

pip install odoorpc
error ImportError: cannot import name 'OdooRPC' from 'odoorpc'
cause Using incorrect import name; class is ODOO (all caps).
fix
Replace 'from odoorpc import OdooRPC' with 'from odoorpc import ODOO'.
error AttributeError: 'ODOO' object has no attribute 'authenticate'
cause Method name is .login(), not .authenticate().
fix
Use .login(database, username, password) instead of .authenticate().
error xmlrpc.client.Fault: <Fault -2: 'Wrong server block size'>
cause Using deprecated XML-RPC protocol with Odoo 12+; JSON-RPC is recommended.
fix
Specify protocol='jsonrpc' when creating ODOO object.
deprecated The default protocol 'xmlrpc' is deprecated. Use 'jsonrpc' instead.
fix Explicitly pass protocol='jsonrpc' when creating the ODOO instance.
gotcha The class name is ODOO (all caps), not OdooRPC or Odoo. Many users incorrectly import from odoorpc import Odoo.
fix Use "from odoorpc import ODOO" (uppercase).
gotcha The login method is .login(), not .authenticate() or .connect(). Confusion arises from other Odoo libraries.
fix Call odoo.login(database, username, password).

Connect to an Odoo server, authenticate, access environment, and perform basic operations.

from odoorpc import ODOO

odoo = ODOO('localhost', port=8069, protocol='jsonrpc')
odoo.login('database_name', 'user', 'password')
user = odoo.env.user
print(user.name)
# Search records
partners = odoo.env['res.partner'].search([('is_company', '=', True)])
print(partners)