Sometimes, we need to develop some projects with different Odoo version. So we need to make sure that the project’s dependencies will not interfere with the dependencies of other projects that can be running a different version of Odoo or will use different third-party add-on modules, which need different versions of Python dependencies.
This article will step by step to set up a multi-version Odoo development environment locally for Ubuntu.
Dependencies need to install for this article:
- Git version control
- Docker to run PostgreSQL
- Other dependencies such as psycopg, wkhtmltopdf, libpq-dev, libldap2-dev, libsasl2-dev, libxslt1-dev,…
Docker-compose file for PostgreSQL with default database is odoo_13.
Run docker-compose up to create a container. Then connecting to DB and create new database odoo_12
Create a workspace with structure.
│ ├── bin // Include various helper executable shell scripts
│ ├── filestore // Use as a file store
│ ├── local // Save your instance-specific add-ons (module)
│ ├── logs // Store the server log files
│ └── src // Contains the clone of Odoo itself
Setup Odoo version 13 development environment
Navigating Commandline to workspace/odoo-13 and run.
virtualenv -p python3 env
git clone https://github.com/odoo/odoo.git src/odoo
env/bin/pip3 install -r src/odoo/requirements.txt
Save the following shell script as bin/odoo :
$PYTHON $ODOO -c $ROOT/local.cfg "$@"
Make the script executable:
chmod +x bin/odoo
Create a local.cfg configuration file for your instance:
addons_path = currentDir/src/odoo/odoo/addons, currentDir/src/odoo/addons, currentDir/local
data_dir = currentDir/filestore
db_host = localhost
db_user = odoo
db_password = odoo
db_name = odoo_13
bin/odoo -i base
Setup Odoo version 12 development environment
Every step is the same as version 13. We only update route odoo-13 to odoo-12, db_name = odoo_13 to db_name = odoo_12 in local.cfg and git clone source from brand odoo 12.
git clone https://www.github.com/odoo/odoo --depth 1 --branch 12.0 --single-branch
By isolation dependencies for every Odoo version. We will prevent the conflict when developing Odoo modules for every version locally.
I hope this article will be helpful.
Originally published at https://blog.innomizetech.com on January 3, 2020.