Registry / database / odoorpc

odoorpc

JSON →
library0.10.1pypypi✓ verified 84d ago

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
INSTALL
IMPORT
SIG · ODOORPC
O
odoorpc
databasepythonv0.10.1
Install
1.5s avg
Import
130ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.10.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.134s · 18.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.126s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ODOO
from odoorpc import ODOO
from odoorpc import OdooRPC
Class is named ODOO (all caps) not OdooRPC
login method
odoo.login('db', 'user', 'pass')
odoo.authenticate('db', 'user', 'pass')
Method is .login(), not .authenticate()

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)
Debug
Known issues
deprecatedThe default protocol 'xmlrpc' is deprecated. Use 'jsonrpc' instead.
fix
Explicitly pass protocol='jsonrpc' when creating the ODOO instance.
affects: >=0.8
gotchaThe 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).
affects: all
gotchaThe login method is .login(), not .authenticate() or .connect(). Confusion arises from other Odoo libraries.
fix
Call odoo.login(database, username, password).
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'OdooRPC' from 'odoorpc'
Using incorrect import name; class is ODOO (all caps).
fix
Replace 'from odoorpc import OdooRPC' with 'from odoorpc import ODOO'.
AttributeError: 'ODOO' object has no attribute 'authenticate'
Method name is .login(), not .authenticate().
fix
Use .login(database, username, password) instead of .authenticate().
xmlrpc.client.Fault: <Fault -2: 'Wrong server block size'>
Using deprecated XML-RPC protocol with Odoo 12+; JSON-RPC is recommended.
fix
Specify protocol='jsonrpc' when creating ODOO object.
Upgrade
Version history
0.10.1latest on PyPI · released Aug 16, 2023
Audit
Dependencies
suds-communityrequiredHandles XML-RPC communication when using XML-RPC protocol (default)
Agent activity
4 hits · last 30 days
node
4
Resources
odoorpc — pip install odoorpc · libregistry