OpenUpgrade icon indicating copy to clipboard operation
OpenUpgrade copied to clipboard

[13.0] OpenUpgrade don't run base modules migration scripts

Open tonyctalope opened this issue 3 years ago • 6 comments

12 ➡️ 13:

Describe the bug

When I try to migrate from Odoo version 12.0 to version 13.0 using OpenUpgrade, only OCA migration scripts are executed, not the base module ones.

To Reproduce

Firstly I'm going to describe my environnement.

I am only using Docker for this purpose. I have already cloned the OpenUpgrade project using the command git clone -b 13.0 https://github.com/OCA/OpenUpgrade.git and added the OCA modules using the command git clone -b 13.0 https://github.com/OCA/<module_name>.git to it. Additionally, I have cloned the 12.0 version of the OCA modules and placed them in the ./addons12/oca folder. Dockerfile :

FROM odoo:13 as odoo13

USER root

RUN apt update \
    && apt install -y git \
    && pip3 install --upgrade pip \
    && pip3 install git+https://github.com/OCA/openupgradelib.git@master#egg=openupgradelib \
    && pip3 install polib

WORKDIR /etc/odoo/OpenUpgrade

docker-compose.yml :

version: '3.8'
services:
  upgrade13:
    build:
      context: .
      target: odoo13
    depends_on:
      - db
    volumes:
      - odoo-web-data:/var/lib/odoo
      - ./OpenUpgrade:/etc/odoo/OpenUpgrade
      - ./config/odoo_upgrade13.conf:/etc/odoo/odoo.conf
    command: ./odoo-bin -c /etc/odoo/odoo.conf -d odoo_migration -u all --stop-after-init

  web12:
    image: odoo:12
    depends_on:
      - db
    ports:
      - 8012:8069
    volumes:
      - odoo-web-data:/var/lib/odoo
      - ./config/odoo_web.conf:/etc/odoo/odoo.conf
      - ./addons12/oca:/mnt/extra-addons/oca

  db:
    image: postgres:12.2-alpine
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_PASSWORD=odoo
      - POSTGRES_USER=odoo
      - PGDATA=/var/lib/postgresql/data/pgdata
    volumes:
      - dbdata-odoo:/var/lib/postgresql/data

volumes:
  odoo-web-data:
  dbdata-odoo:

odoo_web.conf

[options]
db_host = db
db_user = odoo
db_password = odoo
admin_passwd = odoo
addons_path = /mnt/extra-addons/oca
log_db = False
log_db_level = warning
log_level  = debug
logfile = None
without_demo = all

odoo_upgrade13.conf

[options]
db_host = db
db_user = odoo
db_password = odoo
admin_passwd = odoo
data_dir = /var/lib/odoo/.local/share/Odoo
addons_path= /etc/odoo/OpenUpgrade/addons
log_db = False
log_db_level = warning
log_level  = debug
logfile = ./logging.log

Then, how I am going the actual migration

I launch the database using the command docker-compose up -d db. Then, I create a new database in Odoo 12.0 using the command docker-compose up web12, and install the account_asset_management module. After that, I add some basic data and close the Docker application. The database is named odoo_migration.

Now, I simply run the migration using the command docker-compose up upgrade13. Here is the log showing the loading of the account module:

DEBUG odoo_migration odoo.modules.loading: loading module account (29/35) 
INFO odoo_migration odoo.modules.registry: module account: creating or updating database tables 

.... A lot of table editions ....

INFO odoo_migration odoo.modules.loading: loading account/security/account_security.xml 
INFO odoo_migration odoo.modules.loading: loading account/security/ir.model.access.csv 
INFO odoo_migration odoo.modules.loading: loading account/data/data_account_type.xml 
INFO odoo_migration odoo.modules.loading: loading account/data/account_data.xml 
INFO odoo_migration odoo.modules.loading: loading account/data/digest_data.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account_menuitem.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account_payment_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/wizard/account_accrual_accounting_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/wizard/account_unreconcile_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/wizard/account_move_reversal_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account_move_views.xml 
INFO odoo_migration odoo.modules.loading: loading account/wizard/setup_wizards_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/wizard/pos_box.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/partner_view.xml 
DEBUG odoo_migration odoo.tools.translate: translation went wrong for ""Element '%s' cannot be located in parent view"", skipped 
INFO odoo_migration odoo.addons.base.models.ir_ui_view: Element '<button name="toggle_active">' cannot be located in parent view

Error context:
View `partner.view.button.contracts_count`
[view_id: 539, xml_id: account.partner_view_button_contracts_count, model: res.partner, parent_id: 113] 
DEBUG odoo_migration odoo.tools.translate: translation went wrong for ""Element '%s' cannot be located in parent view"", skipped 
INFO odoo_migration odoo.addons.base.models.ir_ui_view: Element '<button name="toggle_active">' cannot be located in parent view

Error context:
View `partner.view.button.contracts_count`
[view_id: 539, xml_id: account.partner_view_button_contracts_count, model: res.partner, parent_id: 113] 
INFO odoo_migration odoo.modules.loading: loading account/views/account_view.xml 
INFO odoo_migration odoo.models.unlink: User #1 deleted ir.actions.act_window.view records with IDs: [22, 23, 24] 
INFO odoo_migration odoo.models.unlink: User #1 deleted ir.actions.act_window.view records with IDs: [25, 26, 27] 
INFO odoo_migration odoo.modules.loading: loading account/views/report_statement.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account_report.xml 
INFO odoo_migration odoo.modules.loading: loading account/data/mail_template_data.xml 
INFO odoo_migration odoo.modules.loading: loading account/wizard/account_validate_move_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account_end_fy.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/product_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account_analytic_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account_tip_data.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/report_invoice.xml 
INFO odoo_migration odoo.modules.loading: loading account/report/account_invoice_report_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account_cash_rounding_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/wizard/account_report_common_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/report_journal.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/tax_adjustments.xml 
INFO odoo_migration odoo.modules.loading: loading account/wizard/wizard_tax_adjustments_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/res_config_settings_views.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account_journal_dashboard_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account_portal_templates.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/report_payment_receipt_templates.xml 
INFO odoo_migration odoo.modules.loading: loading account/data/payment_receipt_data.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account_onboarding_templates.xml 
INFO odoo_migration odoo.modules.loading: loading account/data/service_cron.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account_fiscal_year_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account_incoterms_view.xml 
INFO odoo_migration odoo.modules.loading: loading account/data/account_incoterms_data.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/digest_views.xml 
INFO odoo_migration odoo.modules.loading: loading account/wizard/account_invoice_send_views.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/account_tax_report_views.xml 
INFO odoo_migration odoo.modules.loading: loading account/views/report_statement.xml 
INFO odoo_migration odoo.modules.loading: loading account/report/account_hash_integrity_templates.xml

And some log of the account_asset_management module :

INFO odoo_migration odoo.modules.migration: module account_asset_management: Running migration [13.0.1.0.0>] post-migration 
INFO odoo_migration OpenUpgrade: account_asset_management: post-migration script called with version 12.0.3.2.0 

(Moreover, I got the migration scripts for the base module : INFO odoo_migration odoo.modules.migration: module base: Running migration [>13.0.1.3] pre-migration)

Expected behavior As you can see, the migration scripts of the OCA module are working, but not for the base module. I was expecting a log line similar to this: INFO odoo_migration odoo.modules.migration: module account: Running migration [13.0.1.1.0>] post-migration .

tonyctalope avatar Apr 24 '23 09:04 tonyctalope

Hi @tonyctalope.

Thanks for reporting. As the openupgrade 13.0 project works correctly in the CI and for other people, I suspect a problem in your deployment. If there is no log of the migrations, one of the basic origin is that the code executed is the odoo code and not the openupgrade code. if the base is executed and not the other modules, I think there is a trouble in your addons path. Did you tried to changed it ?

legalsylvain avatar Apr 24 '23 09:04 legalsylvain

Yes, it seems your Docker is using Odoo repository, not OpenUpgrade one. Closing as this is not an issue of OU. Feel free to continue in the Discussions part.

pedrobaeza avatar Apr 24 '23 09:04 pedrobaeza

I did not try to change it as I am not sure what I can change it to. Here is my directory structure: OpenUpgrade |addons | | account | |___ account_asset_management | |___ ... addons ... |___ odoo |___ addons |___ base

My addons_path is /etc/odoo/OpenUpgrade/addons. There may be a problem with the addons_path, but I am confused as to why the migration script for account_asset_management is running without any issues.

My apologies for posting my issue in the wrong section @pedrobaeza. Thank you for your help.

tonyctalope avatar Apr 24 '23 09:04 tonyctalope

Here is the link (https://github.com/OCA/OpenUpgrade/discussions/3831) to continue the discussion.

tonyctalope avatar Apr 24 '23 09:04 tonyctalope

I encountered the same issue, and discovered that in this version of OpenUpgrade, the 13.0 branch, any previously installed addons, for example in /usr/lib/python3/dist-packages/odoo/addons, override the migrations.

Temporarily moving away this directory did the trick for me...

echarp avatar Jul 03 '23 09:07 echarp

I think the addons_path in odoo_upgrade13.conf wasn't complet, must be like this: addons_path = /mnt/extra-addons/OpenUpgrade/addons,/mnt/extra-addons/OpenUpgrade/odoo/addons

However, this is my config for 9 to 10 (Under the guidance https://www.cybrosys.com/blog/how-to-upgrade-the-odoo-15-database-using-openupgrade) :

Imigration v9 to v10 (done with docker compose)

Is posible valid for version < v14 and missing migrate.py in OpenUpgrade/scripts/

The imported db_v9 db will be overwrite, buckup one before migration.

# Create a independent upgrade config file (only 6 lines)
vi addons/OpenUpgrade/upgrade_9-10.conf
    [options]
    db_host = db
    db_port = 5432
    db_user = odoo
    db_password = odoo
    addons_path = /mnt/extra-addons/OpenUpgrade/addons,/mnt/extra-addons/OpenUpgrade/odoo/addons

# change compose file to run upgrade script
vi compose.yaml
    ...
    entrypoint: ["python", "/mnt/extra-addons/OpenUpgrade/odoo-bin"]
    command: ["-c", "/mnt/extra-addons/OpenUpgrade/upgrade_9-10.conf", "--database", "db_v9", "--update", "all", "--stop-after-init"]
    ...

# exec update
docker compose up -d

zzwxrchi avatar May 25 '25 08:05 zzwxrchi