New in version 0.6.
The Common class represents the /common RPC service which lets you log in on the server, and provides various utility functions.
Note
This service have to be used through the oerplib.OERP.common property.
>>> import oerplib
>>> oerp = oerplib.OERP('localhost')
>>> oerp.common
<oerplib.service.common.Common object at 0xb76266ac>
Warning
All methods documented below are not strictly implemented in OERPLib
Method calls are purely dynamic, and the following documentation can be wrong if the API of the server is changed between versions. Anyway, if you know the API proposed by the server for the /common RPC service, it will work.
>>> oerp.common.login('test_db', 'admin', 'admin_passwd')
1
Returns: | the user’s ID or False |
---|
>>> oerp.common.authenticate('test_db', 'admin', 'admin_passwd', {})
1
Returns: | the user’s ID or False |
---|
>>> oerp.common.version()
{'protocol_version': 1, 'server_version': '6.1'}
Return information about the server.
>>> oerp.common.about()
'See http://openerp.com'
>>> oerp.common.about(True)
['See http://openerp.com', '8.0alpha1']
Param: | extended: if True then return version info |
---|---|
Returns: | string if extended is False else tuple |
>>> oerp.common.timezone_get('test_db', 'admin', 'admin_passwd')
'UTC'
>>> print(oerp.common.get_server_environment())
Environment Information :
System : Linux-2.6.32-5-686-i686-with-debian-6.0.4
OS Name : posix
Distributor ID: Debian
Description: Debian GNU/Linux 6.0.4 (squeeze)
Release: 6.0.4
Codename: squeeze
Operating System Release : 2.6.32-5-686
Operating System Version : #1 SMP Mon Mar 26 05:20:33 UTC 2012
Operating System Architecture : 32bit
Operating System Locale : fr_FR.UTF8
Python Version : 2.6.6
OpenERP-Server Version : 5.0.16
Last revision No. & ID :
>>> oerp.common.login_message()
'Welcome'
>>> oerp.common.set_loglevel('DEBUG')
>>> print(oerp.common.get_stats())
OpenERP server: 5 threads
Servers started
Net-RPC: running
>>> oerp.common.list_http_services()
[]
>>> oerp.common.check_connectivity()
True
>>> oerp.common.get_os_time()
(0.01, 0.0, 0.0, 0.0, 17873633.129999999)
>>> oerp.common.get_sqlcount()
>>> oerp.common.get_available_updates('super_admin_passwd', 'MY_CONTRACT_ID', 'MY_CONTRACT_PASSWORD')
>>> oerp.common.get_migration_scripts('super_admin_passwd', 'MY_CONTRACT_ID', 'MY_CONTRACT_PASSWORD')