Search code examples
odooodoo-15

How do I use openupgradelib to update from odoo15 to odoo16?


When I try to update odoo from v15 to v16 (running in a docker environment) via openupgradelib I encouter two problems:

  1. some modules like account isn't migrated into the new database
  2. and in general the new database is as described as possibly not compatible with the new version 16

I have provided all necessary modules and run the update with the following command (parameters): -c ou_15_16.config --save --database odoo16 --upgrade-path=/mnt/extra-addons/openupgrade_scripts/scripts --load=base,web,account,openupgrade_framework --update all --stop-after-init

I'm using postgres 15.4 to store the database. Am I missing something? I get no errors while the upgrade is running only a list of successfull migrated modules. And no message that some modules like account aren't migrated and I don't see them in the new database.


Solution

  • First of all:

    Odoo images are not updated as frequently as the GitHub code, so they are more likely to give more errors when migrating. It is recommended to migrate in a directly installed environment, not in images. However, the process to migrate with docker is:

    Migration process:

    Openupgrade clone folder

    • In odoo 16: Create an image that contains the openupgradelib library(Modify Dockerfile).Ex:

      FROM odoo:16.0

      USER root

      COPY ./requirements.txt /requirements.txt

      RUN pip3 install -r /requirements.txt

      RUN rm /requirements.txt

      RUN apt-get update && apt-get install -y git

      RUN pip3 install git+https://github.com/OCA/openupgradelib.git@master#egg=openupgradelib

    • Start odoo 16 server (Use: ENTRYPOINT=/usr/bin/python3 -m debugpy --listen 0.0.0.0:5678 /usr/bin/odoo -c /etc/odoo/odoo.conf ).

    env variables file

    env variables

    • In odoo16: Restore the database from backup file of version 15. The database will be restored and will appear in the list of databases with errors. Don't worry about it.

    database with error

    • In odoo 16: Modify the environment variable ENTRYPOINT=/usr/bin/python3 -m debugpy --listen 0.0.0.0:5678 /usr/bin/odoo -c /etc/odoo/odoo.conf -d <data_base_name> --upgrade-path=/var/lib/odoo/custom_addons/OpenUpgrade/openupgrade_scripts/scripts --update all --stop-after-init --load=base,web,openupgrade_framework
    • note: The path /var/lib/odoo/custom_addons/OpenUpgrade/openupgrade_scripts/scripts depends on how the volumes were configured in the docker-compose.yml file.

    compose file volume configuration

    • In odoo16: Add the location of the cloned Openupgrade repository to the configuration file. Ex: /var/lib/odoo/custom_addons/OpenUpgrade, /var/lib/odoo/custom_addons/OpenUpgrade/openupgrade_scripts, /var/lib/odoo/custom_addons/OpenUpgrade/openupgrade_framework
    • On odoo 16: start the server (docker up) and wait. The migration start.
    • On odoo 16: Start the server with ENTRYPOINT=/usr/bin/python3 -m debugpy --listen 0.0.0.0:5678 /usr/bin/odoo -c /etc/odoo/odoo.conf. If everything went well, the database will appear without errors and can be used.

    Final steps: