Odoo Development
The Mint System Odoo development environment.
This projects provides a highly opiniated way to develope Odoo and Odoo modules. It supports the following scenarios:
Docker Compose
Spin up a Odoo, Postgres and PGadmin Docker container and experiment locally.
Import and Export Database
Use Odoo scripts to copy and restore a remote customer database in the local development environment. Investigate issues and deploy the database at whish.
Community Edition
Checkout the Odoo Community Edition and start editing source code.
Enterprise Modules
Checkout the Odoo enterprise modules and deploy them into the Odoo Docker container or the Odoo source.
Develope Modules
Scaffold a new module and develope new Odoo features locally.
Requirements
The Odoo development environment has the following requirements:
- Odoo Scripts
- Docker Compose
- Python3
- Task
- wkhtmltopdf
Usage
The usage section is set of recipes. Pick the one required according the scenarios.
Clone this repository.
git clone https://github.com/Mint-System/Odoo-Development.git odoo-development
cd odoo-development
Install Odoo with Docker
Run docker compose.
task up
Initialize database and install modules.
docker-odoo-install
Open browser to http://localhost:8069 and login with admin:admin.
Enable developer mode
Open this url http://localhost:8069/web?debug=1, which contains the debug flag.
Install Odoo source requirements
Pull the odoo submodule and install the python dependencies.
git submodule update odoo
cd odoo
sudo pip3 install setuptools wheel watchdog
sudo pip3 install -r requirements.txt
Run database container only
task up-db
Start Odoo from source
task up-src
Create new module with Docker
Scaffold a new module.
docker exec -it odoo odoo scaffold sales-customization /mnt/extra-addons
Restart Odoo.
docker restart odoo
Manage database with Docker
Open database manager http://localhost:8000/ and login with admin:admin.
Add a new database connection with these credentials:
Name: odoo
Host: db
Username: odoo
Password: odoo
Remove Docker conainers
Kill docker containers.
docker-compose down -v
Install custom module with Odoo scripts
docker-odoo-install -m show_db_name
Create new database with Docker
docker exec -it odoo bin/bash
createdb -h $HOST -U $USER mint-system --locale=de_CH.utf8 --template=template0
# Enter password
psql -h $HOST -U $USER -l
# Enter password
odoo -i base,web -c /etc/odoo/odoo.conf -d mint-system --db_host $HOST -r $USER -w $PASSWORD --without-demo=all --stop-after-init
# Exit
docker restart odoo
Open http://localhost:8069/?db=Test in your browser.
Delete database with Docker
docker exec -it odoo bin/bash
psql -h $HOST -U $USER -l
# Enter password
dropdb -h $HOST -U $USER mint-system
# Enter password
Save config with Docker
docker exec -it odoo bin/bash -c "odoo -s -d Test --db_host \$HOST -r \$USER -w \$PASSWORD"
Stop all Docker containers
task stop
Install Odoo REST API dependencies
sudo pip3 install -r addons/rest_api/requirements.txt
Or with Docker:
docker exec odoo pip3 install -r /mnt/extra-addons/rest_api/requirements.txt
docker restart odoo
Setup managed modules
Update the entries in the list managed_modules.txt.
Checkout a specific git revision in the Odoo enterprise repository.
Run the script compile-managed-modules to create zip files for the managed modules.
Load and unload managed modules
Run the script copy-managed-modules to load the managed modules into the addons folder.
Execute the script remove-managed-mdoules to delete the managed modules from the addons folder.
Export pgAdmin connections
docker exec -it pgadmin python setup.py --dump-servers /var/tmp/servers.json --user admin@example.com && cat /var/tmp/servers.json