forked from odoo-italia/l10n-italy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
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_causali_pagamento"
NEW_MODULE_NAME = "l10n_it_payment_reason"
def rename_old_italian_module(cr):
openupgrade.rename_xmlids(
cr,
[
(
"l10n_it_payment_reason.view_causale_pagamento_tree",
"l10n_it_payment_reason.view_payment_reason_tree",
),
(
"l10n_it_payment_reason.view_causale_pagamento_form",
"l10n_it_payment_reason.view_payment_reason_form",
),
(
"l10n_it_payment_reason.action_causale_pagamento",
"l10n_it_payment_reason.action_payment_reason",
),
(
"l10n_it_payment_reason.menu_causale_pagamento",
"l10n_it_payment_reason.menu_payment_reason",
),
],
)
openupgrade.rename_models(
cr,
[
("causale.pagamento", "payment.reason"),
],
)
openupgrade.rename_tables(
cr,
[
("causale_pagamento", "payment_reason"),
],
)
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)