This module provides a RPC connector (via the get_connector method) which use the XML-RPC or Net-RPC protocol to communicate with an OpenERP server.
Afterwards, RPC services (like db, common or object) and their methods associated can be accessed dynamically from the connector returned.
Here is an example of how to use it:
Get a RPC connector object:
>>> from oerplib import rpc >>> cnt = rpc.get_connector('localhost', 8069, 'xmlrpc')Login and retrieve ID of the user connected:
>>> uid = cnt.common.login('database', 'user', 'passwd')Execute a query:
>>> res = cnt.object.execute('database', uid, 'passwd', 'res.partner', 'read', 42)Execute a workflow query:
>>> res = cnt.object.exec_workflow('database', uid, 'passwd', 'sale.order', 'order_confirm', 4)
This sub-module is used by OERPLib to execute all queries while abstracting the protocol used.
Return a RPC connector to interact with an OpenERP server. Supported protocols are:
- xmlrpc: Standard XML-RPC protocol (default),
- xmlrpc+ssl: XML-RPC protocol over SSL,
- netrpc: Net-RPC protocol made by OpenERP (deprecated since OpenERP v7.0).
If the version parameter is set to None, the last API supported will be use to send requests to OpenERP. Otherwise, you can force the API to use with the corresponding string version (e.g.: '6.0', '6.1', '7.0', ...):
>>> from oerplib import rpc
>>> cnt = rpc.get_connector('localhost', 8069, 'xmlrpc', version='6.1')