forked from OCA/l10n-italy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhooks.py
55 lines (49 loc) · 1.54 KB
/
hooks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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
OLD_MODULE_NAME = "l10n_it_codici_carica"
NEW_MODULE_NAME = "l10n_it_appointment_code"
def rename_old_italian_module(cr):
openupgrade.rename_xmlids(
cr,
[
(
"l10n_it_appointment_code.view_codice_carica_tree",
"l10n_it_appointment_code.view_appointment_code_tree",
),
(
"l10n_it_appointment_code.view_codice_carica_form",
"l10n_it_appointment_code.view_appointment_code_form",
),
(
"l10n_it_appointment_code.action_codice_carica",
"l10n_it_appointment_code.action_appointment_code",
),
(
"l10n_it_appointment_code.menu_codice_carica",
"l10n_it_appointment_code.menu_appointment_code",
),
],
)
openupgrade.rename_models(
cr,
[
("codice.carica", "appointment.code"),
],
)
openupgrade.rename_tables(
cr,
[
("codice_carica", "appointment_code"),
],
)
def pre_absorb_old_module(cr):
if openupgrade.is_module_installed(cr, OLD_MODULE_NAME):
openupgrade.update_module_names(
cr,
[
(OLD_MODULE_NAME, NEW_MODULE_NAME),
],
merge_modules=True,
)
rename_old_italian_module(cr)