Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 29 additions & 13 deletions openupgrade_scripts/scripts/project/17.0.1.3/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,35 @@ def _convert_ir_ui_view_customs(env):
Odoo 17.0 use the new field `display_in_project`
and `project_id` to show tasks in projects
"""
regex = r"""$$\[(['"])display_project_id\1$$"""
openupgrade.logged_query(
env.cr,
f"""
UPDATE ir_ui_view_custom
SET arch = REGEXP_REPLACE(
arch,
{regex},
$$'&', ['display_in_project', '=', True], ['project_id'$$,
'g')
WHERE arch LIKE '%display_project_id%'
""",
)
open_close_marks = [
("[", "]"),
("(", ")"),
]
quote_marks = [
"'",
'"',
"'",
]
for o, c in open_close_marks:
for q in quote_marks:
from_str = f"{o}{q}display_project_id{q}"
to_str = (
f"{q}&{q}, "
f"{o}{q}display_in_project{q}, {q}={q}, True{c}, "
f"{o}{q}project_id{q}"
)
openupgrade.logged_query(
env.cr,
f"""
UPDATE ir_ui_view_custom
SET arch = REPLACE(
arch,
$${from_str}$$,
$${to_str}$$
)
WHERE arch LIKE '%display_project_id%'
""",
)


@openupgrade.migrate()
Expand Down