Odoo 12 Development Essentials
上QQ阅读APP看书,第一时间看更新

Downloading and installing add-on modules from PyPI

Community-contributed Odoo add-ons can be packaged as Python libraries, published to Python Package Index (PyPI), and installed using pip like other libraries. For this to work, Odoo automatically adds the Python site-packages/ directory, where libraries are installed, to the Odoo addons path configuration. This packaging can be done using the setuptools-odoo tool (https://pypi.org/project/setuptools-odoo).

This is used by the OCA projects (https://github.com/OCA) to package and publish add-on modules on PyPI . Since the same module can exist for different Odoo versions, a prefix with the Odoo version is added to the module name. For example, the odoo12-addon-partner-fax PyPI package is the partner_fax add-on module for Odoo 12, which simply adds a fax field to partner: https://pypi.org/project/odoo12-addon-partner-fax/.

To download this module (and dependencies) from PyPI, and then install it in the odoo12env environment, use the following:

$ source ~/odoo-dev/odoo12env/bin/activate
(odoo12denv) $ pip install odoo12-addon-partner-fax
(odoo12denv) $ odoo -
c ~/odoo-dev/odoo12-env/12-library.conf \
-i partner_fax --stop