Go to file
2022-05-30 13:39:44 +02:00
odoo_openupgrade_wizard [FIX] minor problem on install-from-csv command 2022-05-16 13:32:59 +02:00
tests wip 2022-05-19 17:57:33 +02:00
.gitignore [WIP] refactor simplify tests 2022-05-19 17:33:48 +02:00
.gitlab-ci.yml [TRY] pin python version 2022-05-30 13:39:44 +02:00
.pre-commit-config.yaml [TRY] FIX CI 2022-05-09 16:46:59 +02:00
DEVELOP.md coucou 2022-05-06 14:32:49 +02:00
poetry.lock [TRY] fix 2022-05-30 13:30:25 +02:00
pyproject.toml [IMP] add log_level 2022-05-04 12:34:10 +02:00
pytest.ini [WIP] refactor simplify tests 2022-05-19 17:33:48 +02:00
README.md [ADD] badges 2022-05-16 13:34:18 +02:00
ROADMAP.md [TRY] Fix CI 2022-05-30 13:04:07 +02:00
tox.ini fixup! [FIX] correct name for custom script in execute_script tests 2022-05-04 17:31:14 +02:00

Gitlab CI

codecov

License: AGPL v3

odoo-openupgrade-wizard

Odoo Openupgrade Wizard is a tool that helps developpers to make major upgrade of Odoo Community Edition. (formely OpenERP). It works with Openupgrade OCA tools. (https://github.com/oca/openupgrade)

this tool is useful for complex migrations:

  • skip several versions
  • complex custom code

It will create a migration environment (with all the code available) and provides helpers to run (and replay) migrations until it works.

Installation

pipx install odoo-openupgrade-wizard.

To develop and contribute to the library, refer to the DEVELOP.md file.

Usage

odoo-openupgrade-wizard init

odoo-openupgrade-wizard init\
  --initial-release=10.0\
  --final-release=12.0\
  --project-name=my-customer-10-12\
  --extra-repository=OCA/web,OCA/server-tools

Initialize a folder to make a migration from a 10.0 and a 12.0 database. This will generate the following structure :

config.yml
modules.csv
log/
    2022_03_25__23_12_41__init.log
    ...
scripts/
    step_1__update__10.0/
        pre-migration.sql
        post-migration.py
    step_2__upgrade__11.0/
        pre-migration.sql
        post-migration.py
    step_2__upgrade__12.0/
        pre-migration.sql
        post-migration.py
    step_4__update__12.0/
        pre-migration.sql
        post-migration.py
src/
    env_10.0/
        debian_requirements.txt
        Dockerfile
        odoo.cfg
        python_requirements.txt
        repos.yml
        src/
            odoo/
            openupgrade/
    env_11.0/
        ...
    env_12.0/
        ...

  • config.xml is the main configuration file of your project.

  • modules.csv file is an optional file. You can fill it with the list of your modules installed on your production. The first column of this file should contain the technical name of the module.

  • log folder will contains all the log of the odoo-openupgrade-wizard and the logs of the odoo instance that will be executed.

  • scripts folder contains a folder per migration step. In each step folder:

    • pre-migration.sql can contains extra SQL queries you want to execute before beginning the step.
    • post-migration.py can contains extra python command to execute after the execution of the step. (the orm will be available)
  • src folder contains a folder per Odoo version. In each environment folder:

    • repos.yml enumerates the list of the repositories to use to run the odoo instance. The syntax should respect the gitaggregate command. (See : https://pypi.org/project/git-aggregator/) Repo files are pre-generated. You can update them with your custom settings. (custom branches, extra PRs, git shallow options, etc...)

    • python_requirements.txt enumerates the list of extra python librairies required to run the odoo instance. The syntax should respect the pip install -r command. (See : https://pip.pypa.io/en/stable/reference/requirements-file-format/)

    • debian_requirements.txt enumerates the list of extra system librairies required to run the odoo instance.

At this step, you should change the autogenerated files. You can use default files, if you have a very simple odoo instance without custom code, extra repositories, or dependencies...

odoo-openupgrade-wizard get-code

odoo-openupgrade-wizard get-code

This command will simply get all the Odoo code required to run all the steps for your migration with the gitaggregate tools.

The code is defined in the repos.yml of each sub folders.

Note

  • This step could take a big while !

Optional arguments

if you want to update the code of some given releases, you can provide an extra parameter:

odoo-openupgrade-wizard get-code --releases 10.0,11.0

odoo-openupgrade-wizard docker-build

This will build local docker images that will be used in the following steps.

This script will pull official odoo docker images, defined in the Dockerfile of each folder, and build a custom images on top the official one, installing inside custom librairies defined in debian_requirements.txt, python_requirements.txt.

At this end of this step executing the following command should show a docker image per version.

$ docker images --filter "reference=odoo-openupgrade-wizard-*"

REPOSITORY                                                 TAG       IMAGE ID       CREATED       SIZE
odoo-openupgrade-wizard-image---my-customer-10-12---12.0   latest    ef664c366208   2 weeks ago   1.39GB
odoo-openupgrade-wizard-image---my-customer-10-12---11.0   latest    24e283fe4ae4   2 weeks ago   1.16GB
odoo-openupgrade-wizard-image---my-customer-10-12---10.0   latest    9d94dce2bd4e   2 weeks ago   924MB

Optional arguments

  • if you want to (re)build an image for some given releases, you can provide an extra parameter: --releases 10.0,12.0

Note

  • This step could take a big while also !

odoo-openupgrade-wizard run

odoo-openupgrade-wizard run\
    --step 1\
    --database DB_NAME

Run an Odoo instance with the environment defined by the step argument.

The database will be created, if it doesn't exists.

if stop-after-init is disabled, the odoo instance will be available at your host, at the following url : http://localhost:9069 (Port depends on your host_odoo_xmlrpc_port setting of your config.yml file)

Optional arguments

  • You can add --init-modules=purchase,sale to install modules.

  • You can add stop-after-init flag to turn off the process at the end of the installation.

odoo-openupgrade-wizard install-from-csv

odoo-openupgrade-wizard install-from-csv\
    --database DB_NAME

Install the list of the modules defined in your modules.csv files on the given database.

The database will be created, if it doesn't exists.

odoo-openupgrade-wizard upgrade

odoo-openupgrade-wizard upgrade\
    --database DB_NAME

Realize an upgrade of the database from the initial release to the final release, following the different steps.

For each step, it will :

  1. Execute the pre-migration.sql of the step.
  2. Realize an "update all" (in an upgrade or update context)
  3. Execute the scripts via XML-RPC (via odoorpc) defined in the post-migration.py file.

Optional arguments

  • You can add --first-step=2 to start at the second step.

  • You can add --last-step=3 to end at the third step.