forked from OCA/odoo-module-migrator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmigrate_120_130.py
78 lines (73 loc) · 2.48 KB
/
migrate_120_130.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Copyright (C) 2019 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import re
from odoo_module_migrate.base_migration_script import BaseMigrationScript
_TEXT_ERRORS = {
"*": {
"web_settings_dashboard":
"[V13] Reference to 'web_settings_dashboard'"
". This module has been removed."
},
".py": {
r".*@api.returns.*\n":
"[13] Use of deprecated decorator '@api.returns'",
r".*@api.cr.*\n":
"[13] Use of deprecated decorator '@api.cr'",
r".*@api.model_cr.*\n":
"[13] Use of deprecated decorator '@api.model_cr'",
},
}
_TEXT_REPLACES = {
".py": {
r".*@api.one.*\n": "",
r"\.sudo\((?P<user>[^/)]+?)\)": r".with_user(\g<user>)",
r"\.suspend_security": ".sudo",
r"\"base_suspend_security\",\n": "",
r"\._find_partner_from_emails\(": "._mail_find_partner_from_emails(",
r"\._search_on_partner\(": "._mail_search_on_partner(",
r"\._search_on_user\(": "._mail_search_on_user(",
},
".xml": {
r"( |\t)*<field name=('|\")view_type('|\")>.*</field>\n": "",
r"src_model": "binding_model",
re.compile(
r"""
# find a button...
<button
\s[^>]*
# ... that is a oe_stat_button
class=['"].*\b
oe_stat_button
\b.*['"]
[^>]*>\s*
# ... that contains a field
<field\s+
(
[^>]*
(
# ... named "active"
name=['"]active['"]|
# ... with a boolean_button widget
widget=['"]boolean_button['"]
)
[^>]*
){2}
[^>]*>\s*
</button>
""",
re.VERBOSE,
): """
<field name="active" invisible="1" />
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
/>
""",
},
}
class MigrationScript(BaseMigrationScript):
_TEXT_ERRORS = _TEXT_ERRORS
_TEXT_REPLACES = _TEXT_REPLACES