This is a simple tool for development environments focused to avoid repetitive tasks when work with docker (doodba scaffolding) and git. You can see it like a recopilation of usefull snippets.
This is NOT an official OCA tool
The script uses awesome Odoo projects!
- Doodba by Tecnactiva
- OCA Mantainer Tools Wiki
/!\ This script can be dangerous (for your local branch) if you don't know what you're doing!
- bash
- git
- docker https://docs.docker.com/install/linux/linux-postinstall/
- docker-compose
sudo wget https://raw.githubusercontent.com/Tardo/oca_contrib/master/oca_contrib.sh -O /usr/local/bin/oca_contrib && sudo chmod +x /usr/local/bin/oca_contrib
If you don't want/can't use root privileges to install, only download and use it. The better option is use ~/.local/bin
folder... but some distros haven't set these folder into $PATH
Odoo 12.0 + Add OCA/web repository (all modules enabled)
oca_contrib docker create myproject 12
cd myproject
oca_contrib docker add_modules web
oca_contrib docker build
docker-compose up
Odoo version can be written using MAJOR.MINOR notation or only MAJOR (example: 12.0 or 12)
For more information see https://github.com/Tecnativa/doodba
Download & prepare a generic doodba scaffolding
oca_contrib docker create <proj_name> <version>
- proj_name > The name of the project
- version > The Odoo version to use
** Example, create myproject using Odoo 10.0:
oca_contrib docker create myproject 10
Build the docker (in devel mode). Run this command inside the docker project folder.
oca_contrib docker build
Add repository and enable modules to be installed. Run this command inside the docker project folder.
oca_contrib docker add_modules <repo_url / OCA_repo_name> [modules (separated by comma without spaces)]
- repo > Git repository
- modules > Optional. A list of module names to enable separated by comma
** Example, add OCA/web repository with web_responsive and web_widget_color
oca_contrib docker add_modules web web_responsive,web_widget_color
** Example, add OCA/l10n-spain repository with all modules
oca_contrib docker add_modules l10n-spain
** Example, add Tardo/web repository with all modules
oca_contrib docker add_modules https://github.com/Tardo/web.git
Remove repository and modules from repos.yaml and addons.yaml. Run this command inside the docker project folder.
oca_contrib docker del_modules <repo_name>
** Example, remove OCA/l10n-spain repository with all modules
oca_contrib docker del_modules l10n-spain
Launch unittest of selected modules. Run this command inside the docker project folder.
oca_contrib docker test_modules <modules (separated by comma without spaces)>
** Example, test web_responsive and web_notify modules
oca_contrib docker test_modules web_responsive,web_notify
Re-launch git_aggregator. Run this command inside the docker project folder.
/!\ This command can be dangerous!
oca_contrib docker resync_modules
Install Odoo modules. Run this command inside the docker project folder.
oca_contrib docker install_modules <modules (separated by comma without spaces)>
Update Odoo modules. Run this command inside the docker project folder.
oca_contrib docker update_modules <modules (separated by comma without spaces)>
Run Odoo shell. Run this command inside the docker project folder.
oca_contrib docker shell
Run Odoo Docker bash. Run this command inside the docker project folder.
oca_contrib docker bash
Run docker bash. Run this command inside the docker project folder.
oca_contrib docker psql [database]
- database > Optional. Postgres Database (By default is 'postgres')
Example for devel:
oca_contrib docker psql devel
Restore docker to have a clean folder to rebuild. Run this command inside the docker project folder.
/!\ This command can be dangerous!
oca_contrib docker repair <version>
- version > The Odoo version to use
Example to restore a docker folder to rebuild it with version 12.0:
oca_contrib docker repair 12.0
For more information see https://github.com/OCA/maintainer-tools/wiki
Preapare a new branch to start a migration of a module. Run this command inside the repository folder.
oca_contrib git migrate <module> <version_to> [version_from]
- module > Module names
- version > Odoo version (avoid .0)
** Example, migrate web_shortcut to v11.0. (from v10.0)
oca_contrib git migrate web_shortcut 11
** Example, migrate web_shortcut to v12.0. (from v10.0)
oca_contrib git migrate web_shortcut 12 10
Fetch a pull request to new branch and use it
oca_contrib git use_pr <pr_number>
- pr_number > Pull request ID
** Example, use pull request with id 283
oca_contrib git use_pr 283
Restore git commits history on migration module. Only usefull if you missed it. Run this command inside the repository folder. Using the branch to fix.
/!\ This command can be dangerous!
oca_contrib git fix_history <module> <hash> <version_to> [version_from]
- module > Module name
- version > Odoo version (avoid .0)
- hash > Hash of commit to restore your work
To use this you need squash your commits first and get the hash of these commit.
** Example, restore history to web_shortcut migration. Previously squashed in 1234abc567de
oca_contrib git fix_history web_shortcut 1234abc567de 12 10
** Perhaps needs resolve some conflicts to finish the operation.
Show files with conflicts in a merge/rebase operation. Run this command inside the repository folder.
oca_contrib git show_conflict_files
- MOVE TO PYTHON!!
- Improve modules management
- Add dependencies management
- Enable/Disable docker network visibility
- Enable/Disable internal network
- Can't detect wildcard on addons.yaml when add modules
- Can't select modules to delete