Skip to content

Commit

Permalink
[FIX][14.0] l10n_it_appointment_code migration scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiocorato committed Aug 29, 2023
1 parent b37f192 commit 8a18ee5
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 119 deletions.
1 change: 1 addition & 0 deletions l10n_it_appointment_code/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import models
from .hooks import rename_old_italian_module
1 change: 1 addition & 0 deletions l10n_it_appointment_code/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
"views/appointment_code_view.xml",
],
"installable": True,
"pre_init_hook": "rename_old_italian_module",
}
66 changes: 66 additions & 0 deletions l10n_it_appointment_code/hooks.py
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 l10n_it_appointment_code/migrations/14.0.1.0.0/pre-migrate.py
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)
119 changes: 0 additions & 119 deletions l10n_it_appointment_code/readme/INSTALL.rst

This file was deleted.

0 comments on commit 8a18ee5

Please sign in to comment.