Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: How to test v14 upgrade scripts

by
Sergio Zanchetta
- 25/04/2021 21:53:18
Il giorno ven 29 gen 2021 alle ore 11:27 Holger Brunn
<mail@hunki-enterprises.com> ha scritto:

>

> > In general, is it possible to test v14 upgrade scripts before OpenUpgrade is

>

> > available for v14?

>

> yes, you don't need OpenUpgrade for that.


We did some test using a pre-migrate script like the one linked by Lorenzo (*).
The main purpose is to change the name of the module, as well as
rename xmlids, model and tables.

Steps:

1) old_name module installation
2) add/change some data
3) checkout to commit containing new_name module, migration script and
version bumped
4) launch old_name_module update:
./odoo-bin -c etc/odoo14.cfg -d testdb -u old_name_module --stop-after-init

Output:
old_name_module: not installable, skipped

In fact pre-migrate script is not triggered.

We tried this also:
4) launch new_name_module update:
./odoo-bin -c etc/odoo14.cfg -d testdb -u new_name_module --stop-after-init

But it didn't work as well.


The only way (we have found so far) to trigger pre-migrate script is this:

1) old_name module installation
2) add/change some data
3) checkout to commit containing new_name module, migration script and
version bumped
4) execute odoo shell
    >>> from openupgradelib import openupgrade
    >>> openupgrade.update_module_names(env.cr, [('old_name_module',
'new_name_module'),], merge_modules=False,)
    >>> env.cr.commit()
5) launch new_name_module update:
./odoo-bin -c etc/odoo14.cfg -d testdb -u new_name_module --stop-after-init


Do you know a way to trigger the migration script without using odoo shell?

Thanks in advance.
S.


(*) https://github.com/OCA/l10n-italy/blob/0d65b1f7fa23facd9ef52749571a4a18a58f4045/l10n_it_vat_payability/migrations/14.0.1.0.0/pre-migrate.py

Reference