This is a docker-based project template for Odoo projects. It is based on the official Odoo docker image and uses docker-compose to manage the services.
- Odoo (web)
- Python Container which runs Odoo server
- PostgreSQL (db)
- Database container for Odoo
- MailHog (mailhog)
- SMTP server for testing email functionality
-
Docker
-
Docker Compose
-
Git
-
Python
-
Pip
-
NOTE: Currently testing using a submodule in this boilerplate repo. For now, after cloning, update with
git submodule update --init --recursivebefore launching the docker container.
- Create a new directory. This directory will contain the odoo source code and all projects from our customers.
- Clone the odoo source code (odoo-16, odoo-17, odoo-enterprise-16,
odoo-enterprise-17, [and any other version that is currently used]) into the directory. Should look like this:
- project-directory-name:
- odoo-16
- odoo-17
- odoo-18
- odoo-boilerplate
- odoo-enterprise-16
- odoo-enterprise-17
- odoo-enterprise-18
- ...
- CustomerProject1 (directly cloned from the customer's repository)
- The customer's project files
- ...
- ...
- project-directory-name:
- Open the project directory in PyCharm
- Run
bash install-requirements.sh - Rename the
docker-compose.local.yamlfile todocker-compose.yaml - Edit the mounts where necessary (This will not be necessary, if the setup was done and the directory structure is as described in the prerequisites)
- FIRST Run
git submodule update --init --recursive - Then run
docker-compose up -d - If it's a customer project, run
bash set-user-password.shand use "test" as the password. This will set the admin password to "test". - Open the browser and navigate to
http://localhost:8069, there enter the required information to create a new database (just use odoo or test everywhere) - To create a new module run
docker-compose exec web odoo scaffold <module-name> /mnt/custom-addons
This project is capable of debugging Odoo using PyCharm. To do so, follow the steps below:
- Create a new Python Remote Debug configuration in PyCharm
- https://www.jetbrains.com/help/pycharm/remote-debugging-with-product.html Python remote debug server configuration
- Port: 8889
- Hostname: host.docker.internal
- Path mappings: the absolute paths on the local machine to the paths in the container (see docker-compose.yaml for
these paths)
should be absolute: ...odoo-enterprise-17=/mnt/enterprise-addonsshould be absolute: ...odoo-17/odoo=/usr/lib/python3/dist-packages/odooshould be absolute: ...odoo-17/addons=/usr/lib/python3/dist-packages/odoo/addonsshould be absolute: ...custom-addons=/mnt/custom-addonsshould be absolute: ...multioss-addons=/mnt/multioss-addonsshould be absolute: ...3rd-party-addons=/mnt/3rd-party-addons
- Run the debug configuration
- Start Odoo with
docker-compose up -dor restart the web service withdocker-compose restart web - Add breakpoints in the code