odoorpc.tools

This module contains the Config class which manage the configuration related to an instance of ODOO, and some useful helper functions used internally in OdooRPC.

class odoorpc.tools.Config(odoo, options)

Class which manage the configuration of an ODOO instance.

Note

This class have to be used through the odoorpc.ODOO.config property.

>>> import odoorpc
>>> odoo = odoorpc.ODOO('localhost')    
>>> type(odoo.config)
<class 'odoorpc.tools.Config'>
odoorpc.tools.clean_version(version)

Clean a version string.

>>> from odoorpc.tools import clean_version
>>> clean_version('7.0alpha-20121206-000102')
'7.0'
Returns

a cleaner version string

odoorpc.tools.get_encodings(hint_encoding='utf-8')

Used to try different encoding. Function copied from Odoo 11.0 (odoo.loglevels.get_encodings). This piece of code is licensed under the LGPL-v3 and so it is compatible with the LGPL-v3 license of OdooRPC:

- https://github.com/odoo/odoo/blob/11.0/LICENSE
- https://github.com/odoo/odoo/blob/11.0/COPYRIGHT
odoorpc.tools.v(version)

Convert a version string to a tuple. The tuple can be use to compare versions between them.

>>> from odoorpc.tools import v
>>> v('7.0')
[7, 0]
>>> v('6.1')
[6, 1]
>>> v('7.0') < v('6.1')
False
Returns

the version as tuple