Oerplib3
OERPLib3 is a Python module providing an easy way to pilot your OpenERP and Odoo servers through RPC.
It is a fork for python3 of OERPLib project by Sébastien Alix who have not participated to development of this module.
This module work exactly like original OERPLib
import oerplib3 as oerplib
# Prepare the connection to the server
oerp = oerplib.OERP('localhost', protocol='xmlrpc', port=8069)
# Check available databases
print(oerp.db.list())
# Login (the object returned is a browsable record)
user = oerp.login('user', 'passwd', 'db_name')
print(user.name) # name of the user connected
print(user.company_id.name) # the name of its company
# Simple 'raw' query
user_data = oerp.execute('res.users', 'read', [user.id])
print(user_data)
# Use all methods of an OSV class
order_obj = oerp.get('sale.order')
order_ids = order_obj.search([])
for order in order_obj.browse(order_ids):
print(order.name)
products = [line.product_id.name for line in order.order_line]
print(products)
# Update data through a browsable record
user.name = "Brian Jones"
oerp.write_record(user)