-
-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX][14.0] l10n_it_appointment_code migration scripts
- Loading branch information
1 parent
b37f192
commit 8a18ee5
Showing
5 changed files
with
82 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import models | ||
from .hooks import rename_old_italian_module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,5 @@ | |
"views/appointment_code_view.xml", | ||
], | ||
"installable": True, | ||
"pre_init_hook": "rename_old_italian_module", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Copyright 2020 Marco Colombo <https://github.com/TheMule71> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from openupgradelib import openupgrade | ||
|
||
|
||
def rename_old_italian_module(cr): | ||
|
||
if not openupgrade.is_module_installed(cr, "l10n_it_codici_carica"): | ||
return | ||
|
||
openupgrade.rename_xmlids( | ||
cr, | ||
[ | ||
( | ||
"l10n_it_codici_carica.view_codice_carica_tree", | ||
"l10n_it_appointment_code.view_appointment_code_tree", | ||
), | ||
( | ||
"l10n_it_codici_carica.view_codice_carica_form", | ||
"l10n_it_appointment_code.view_appointment_code_form", | ||
), | ||
( | ||
"l10n_it_codici_carica.action_codice_carica", | ||
"l10n_it_appointment_code.action_appointment_code", | ||
), | ||
( | ||
"l10n_it_codici_carica.menu_codice_carica", | ||
"l10n_it_appointment_code.menu_appointment_code", | ||
), | ||
("l10n_it_codici_carica.1", "l10n_it_appointment_code.1"), | ||
("l10n_it_codici_carica.2", "l10n_it_appointment_code.2"), | ||
("l10n_it_codici_carica.3", "l10n_it_appointment_code.3"), | ||
("l10n_it_codici_carica.4", "l10n_it_appointment_code.4"), | ||
("l10n_it_codici_carica.5", "l10n_it_appointment_code.5"), | ||
("l10n_it_codici_carica.6", "l10n_it_appointment_code.6"), | ||
("l10n_it_codici_carica.7", "l10n_it_appointment_code.7"), | ||
("l10n_it_codici_carica.8", "l10n_it_appointment_code.8"), | ||
("l10n_it_codici_carica.9", "l10n_it_appointment_code.9"), | ||
("l10n_it_codici_carica.10", "l10n_it_appointment_code.10"), | ||
("l10n_it_codici_carica.11", "l10n_it_appointment_code.11"), | ||
("l10n_it_codici_carica.12", "l10n_it_appointment_code.12"), | ||
("l10n_it_codici_carica.13", "l10n_it_appointment_code.13"), | ||
("l10n_it_codici_carica.14", "l10n_it_appointment_code.14"), | ||
("l10n_it_codici_carica.15", "l10n_it_appointment_code.15"), | ||
], | ||
) | ||
openupgrade.update_module_names( | ||
cr, | ||
[ | ||
("l10n_it_codici_carica", "l10n_it_appointment_code"), | ||
], | ||
merge_modules=True, | ||
) | ||
openupgrade.rename_models( | ||
cr, | ||
[ | ||
("codice.carica", "appointment.code"), | ||
], | ||
) | ||
openupgrade.rename_tables( | ||
cr, | ||
[ | ||
("codice_carica", "appointment_code"), | ||
], | ||
) |
14 changes: 14 additions & 0 deletions
14
l10n_it_appointment_code/migrations/14.0.1.0.0/pre-migrate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2020 Marco Colombo <https://github.com/TheMule71> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from openupgradelib import openupgrade | ||
|
||
from odoo.addons.l10n_it_appointment_code import hooks | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, installed_version): | ||
# Used by OpenUpgrade when module is in `apriori` | ||
if not installed_version: | ||
return | ||
hooks.rename_old_italian_module(env.cr) |
This file was deleted.
Oops, something went wrong.