Skip to content

Scripts to make the life easier when develop stuff for Odoo (OCA)

Notifications You must be signed in to change notification settings

Tardo/oca_contrib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

OCA CONTRIB 0.7.0 - Shell Script for BASH

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!

SYSTEM DEPENDENCIES


INSTALLATION

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


EXAMPLE USAGE

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

Table of Parameters


DETAILED USAGE

Odoo version can be written using MAJOR.MINOR notation or only MAJOR (example: 12.0 or 12)

+ DOCKER MANAGEMENT (DOODBA)

For more information see https://github.com/Tecnativa/doodba

⚫ Create

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

Build the docker (in devel mode). Run this command inside the docker project folder.

oca_contrib docker build
⚫ Add Modules

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
⚫ Delete Modules

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
⚫ Test Modules

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
⚫ Resync Modules

Re-launch git_aggregator. Run this command inside the docker project folder.

/!\ This command can be dangerous!

oca_contrib docker resync_modules
⚫ Install Modules

Install Odoo modules. Run this command inside the docker project folder.

oca_contrib docker install_modules <modules (separated by comma without spaces)>
⚫ Update Modules

Update Odoo modules. Run this command inside the docker project folder.

oca_contrib docker update_modules <modules (separated by comma without spaces)>
⚫ Odoo Shell

Run Odoo shell. Run this command inside the docker project folder.

oca_contrib docker shell
⚫ Odoo Docker Bash

Run Odoo Docker bash. Run this command inside the docker project folder.

oca_contrib docker bash
⚫ DB Docker psql

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
⚫ Docker Repair Folder

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

+ GIT MANAGEMENT

For more information see https://github.com/OCA/maintainer-tools/wiki

⚫ Migrate

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
⚫ Use PR

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
⚫ Fix History

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 Conflicting Files

Show files with conflicts in a merge/rebase operation. Run this command inside the repository folder.

oca_contrib git show_conflict_files

ROADMAP

  • MOVE TO PYTHON!!
  • Improve modules management
  • Add dependencies management
  • Enable/Disable docker network visibility
  • Enable/Disable internal network

KNOWN ISSUES

  • Can't detect wildcard on addons.yaml when add modules
  • Can't select modules to delete

About

Scripts to make the life easier when develop stuff for Odoo (OCA)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages