-
-
Notifications
You must be signed in to change notification settings - Fork 337
[18.0] [FIX] l10n_it_riba_oca: fix scripts for OpenUpgrade migration #5131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,8 @@ | |
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
| from odoo import api | ||
|
|
||
| OLD_MODULE_NAME = "l10n_it_ricevute_bancarie" | ||
| NEW_MODULE_NAME = "l10n_it_riba" | ||
|
|
||
|
|
@@ -15,3 +17,13 @@ def pre_absorb_old_module(env): | |
| ], | ||
| merge_modules=True, | ||
| ) | ||
|
|
||
|
|
||
| def migrate_old_module(cr): | ||
| """Migration wrapper to absorb old l10n_it_riba module into l10n_it_riba_oca. | ||
|
|
||
| Called from pre-migration script with cursor-only access. | ||
| Creates an env from cr and delegates to pre_absorb_old_module. | ||
| """ | ||
| env = api.Environment(cr, 1, {}) # uid=1 (admin), empty context | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. L'utente con ID 1 non è admin ma Odoobot |
||
| pre_absorb_old_module(env) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Se l'unica cosa da fare nella migrazione è rinominare il modulo, probabilmente non serve nemmeno questo file perché la rinomina viene già eseguita in https://github.com/OCA/OpenUpgrade/blob/82572397744b96c1a1ad706d8a911abc90ee4dea/openupgrade_scripts/scripts/base/18.0.1.3/pre-migration.py#L74, puoi verificare? |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,6 @@ | |||||||||||||||||||
| from odoo.addons.l10n_it_riba_oca import hooks | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
| def migrate(cr, installed_version): | ||||||||||||||||||||
| def migrate(cr, version): | ||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Se questo non serve meglio toglierlo, così in questo commit ci sono solo le modifiche necessarie |
||||||||||||||||||||
| # Used by OpenUpgrade when module is in `apriori` | ||||||||||||||||||||
| hooks.migrate_old_module(cr) | ||||||||||||||||||||
|
Comment on lines
11
to
16
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possiamo invece usare l10n-italy/l10n_it_account_vat_period_end_settlement/migrations/18.0.1.0.0/pre-migrate.py Lines 4 to 12 in 02aafa9
|
||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non riguarda le modifiche di questa PR, ma ho notato che qui si usa
merge_modules=True, mentre in https://github.com/OCA/OpenUpgrade/blob/82572397744b96c1a1ad706d8a911abc90ee4dea/openupgrade_scripts/apriori.py#L25 il modulo è elencato tra i moduli da rinominare, puoi verificare se serve davvero usaremerge_modulesoppure no?Se serve, allora il modulo va spostato nella lista dei moduli da mergiare; altrimenti va tolto da qui.
Così la migrazione tramite OpenUpgrade e l'hook di init fanno le stesse operazioni.