Skip to main content

An Odoo launcher that discovers addons automatically

Project description

License: LGPL-3

Odoo server startup scripts that discover Odoo addons automatically without the need of the --addons-path option. They work by looking at addons in the odoo_addons namespace package.

This is the basic building block to package and distribute Odoo addons using standard python infrastructure (ie setuptools, pip, wheel, and pypi).

The following thin wrappers around official Odoo startup scripts are provided:

  • odoo-autodiscover.py is the equivalent of odoo.py

  • openerp-server-autodiscover is the equivalent of openerp-server

  • odoo-server-autodiscover is an alias for openerp-server-autodiscover

These scripts have exactly the same behaviour and options as their official Odoo counterparts, except they look for additional addons by examining all distributions providing the odoo_addons namespace package.

How to install

  • create a virtualenv and make sure you have a recent version of pip (by running pip install -U pip or using get-pip.py)

  • install Odoo with the standard Odoo installation procedure

  • make sure Odoo is installed (the following commands must work: python -c "import openerp", odoo.py and openerp-server, and pip list must show the odoo package)

  • install this package (pip install odoo-autodiscover)

How to use

  • create or install odoo addons in the odoo_addons namespace package possibly with the help of the setuptools-odoo package.

  • run odoo with openerp-server-autodiscover or odoo-autodiscover.py and notice the addons path is constructued automatically

Complete example

The following commands install Odoo 8.0 nightly, then install base_import_async pulling all required dependencies automatically (ie connector).

# create and activate a virtualenv
virtualenv venv
./venv/bin/activate
# install Odoo 8.0 nightly
pip install -r https://raw.githubusercontent.com/odoo/odoo/8.0/requirements.txt
pip install https://nightly.odoo.com/8.0/nightly/src/odoo_8.0.latest.zip
# install odoo-autodiscover
pip install odoo-autodiscover
# install base_import_async from wheelhouse.acsone.eu
pip install odoo-addon-base_import_async --find-links=https://wheelhouse.acsone.eu/oca-8.0 --no-index
# start odoo
openerp-server-autodiscover

Technical note

Since it’s not possible to make openerp.addons a namespace package (because openerp/__init__.py contains code), we use a pseudo-package named odoo_addons for the sole purpose of discovering addons installed with setuptools in that namespace. odoo_addons is not intended to be imported as the Odoo import hook will make sure all addons can be imported from openerp.addons as usual.

See https://pythonhosted.org/setuptools/pkg_resources.html for more information about namespace packages.

See https://github.com/odoo/odoo/pull/8758 to follow progress with making openerp.addons a namespace package, which will hopefully make this package obsolete in the future.

Credits

Author:

  • Stéphane Bidoul (ACSONE)

Many thanks to Daniel Reis who cleared the path, and Laurent Mignon who convinced me it was possible to do it using standard Python setup tools and had the idea of the odoo_addons namespace package.

Changes

1.0.0 (2015-12-28)

  • initial stable release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odoo-autodiscover-1.0.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

odoo_autodiscover-1.0.0-py27-none-any.whl (7.7 kB view details)

Uploaded Python 2.7

File details

Details for the file odoo-autodiscover-1.0.0.tar.gz.

File metadata

File hashes

Hashes for odoo-autodiscover-1.0.0.tar.gz
Algorithm Hash digest
SHA256 202a26085452bc1439eebddfd804f2a6687d98358742463085a6949f89873845
MD5 91dae4747eb0d6e8ef2ee416dd585b98
BLAKE2b-256 2e09aa27720cf448937c24d02f04e6b357a7da89ddbfd721cbf91a4b2cc7d5b8

See more details on using hashes here.

File details

Details for the file odoo_autodiscover-1.0.0-py27-none-any.whl.

File metadata

File hashes

Hashes for odoo_autodiscover-1.0.0-py27-none-any.whl
Algorithm Hash digest
SHA256 ec50d4a40a1a00ca37f010598f4774291dbc78d4d8674f64c86948f1cce30f48
MD5 60480995240142618d41dca8932fad50
BLAKE2b-256 0cd2a5b4d9423853d3cfe4599686c17f04a28a8fd99877af31d83a3a1623d563

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page