Community mailing list archives

Re: Full API Spec / Exmaples?

Anders Wallenquist
- 03/31/2015 08:22:32

On 2015-03-31 12:49, Mark Benson wrote:
> Hi,
> I am examining the Odoo API to determine how easy or hard it will be 
> to integrate wit our website ordering system (many years in the making 
> and honed specifically to our client needs). I am a competent and 
> experienced developer but I find the API section of the documentation 
> woefully inadequate for working out how to interface with the API. 
> Also I am not able to find the database specs for Odoo so I actually 
> know what to ask for.
> Are there any better, more comprehensive documents for this? Do I need 
> to read the whole developer doc set, just to understand the API (I am 
> not writing stuff to fit inside Odoo, so a lot of that would be 
> redundant??)

This is the general documentation

This is the specifics for webservice-api

There are examples for several languages, but all languages that have 
XMLRPC will do.

It helps to understand Odoo ORM-implemenation (common API for python and 

Usually you need to use the search, read, create, write and other 
methods interacting with your classes.
You can extend any class with your own methods if it makes the 
integration more easy.

You have all installed classes in a searchable view within your 
Activate Technical Features for a user and use the menu Settings / 
Technical / Database  / Models to browse your installation.

If you dont want to use the Odoo API there are some other nice 
libraries, for example oerplib

aw@maggie:~$ sudo pip install oerplib


import  oerplib

# Prepare the connection to the server
oerp  =  oerplib.OERP('localhost',  protocol='xmlrpc',  port=8069)

# Check available databases

# Login (the object returned is a browsable record)
user  =  oerp.login('user',  'passwd',  'db_name')
print(             # name of the user connected
print(  # the name of its company

# Simple 'raw' query
user_data  =  oerp.execute('res.users',  'read',  [])

# Use all methods of an OSV class
order_obj  =  oerp.get('sale.order')
order_ids  =[])
for  order  in  order_obj.browse(order_ids):
     products  =  [  for  line  in  order.order_line]

# Update data through a browsable record  =  "Brian Jones"

Anders Wallenquist
Vertel AB
> It seems very unfortunate for an Open Source project to have no clear, 
> comprehensive API docs.
> Also, if anyone replies to offer services we are open top using UK 
> companies ONLY, thanks.
> -- 
> Mark Benson
> _______________________________________________
> Mailing-List:
> Post to:
> Unsubscribe: