Get Server Version
common = xmlrpclib.ServerProxy('{}/xmlrpc/2/common'.format(url))
common.version()
{ "server_version": "8.0",
"server_version_info": [8, 0, 0, "final", 0],
"server_serie": "8.0",
"protocol_version": 1,
}
Login
uid = common.authenticate(db, username, password, {})
Call Method
models = xmlrpclib.ServerProxy('{}/xmlrpc/2/object'.format(url))
models.execute_kw(db, uid, password,
'res.partner',
'check_access_rights',
['read'],
{'raise_exception': False}
)
Search Function
models.execute_kw(db, uid, password,
'res.partner',
'search',
[
[['is_company', '=', True], ['customer', '=', True]]
],
{'offset': 10, 'limit': 5}
)
Example
models.execute_kw(db, uid, password,
'odoo.model',
'function_name',
[
positional_argument_1,
positional_argument_2,
],
{
'karg_1': 10,
'karg_2': 5
}
)
TypeError: cannot marshal None unless allow_none is enabled
OpenERP's XMLRPC protocol doesn't allow the None values to pass to the client. So you need to replace those None values by False.
To identify which values are passed as None just start your server with --log-level='debug_rpc_answer' and check the last rpc_answer sent to the client.
Or add "allow_none=True" to all xmlrpc.ServerProxy calls in rpc.py in the GTK client.