From d18812af6c28ab50f0c0eed0d9402d6d7207645e Mon Sep 17 00:00:00 2001 From: AnhBT Date: Mon, 17 Nov 2025 22:59:19 +0700 Subject: [PATCH] [MIG] project: Add migration for Odoo 16.0 project dashboard --- .../project/17.0.1.3/post-migration.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/openupgrade_scripts/scripts/project/17.0.1.3/post-migration.py b/openupgrade_scripts/scripts/project/17.0.1.3/post-migration.py index a1130032840..42c5fbc45b2 100644 --- a/openupgrade_scripts/scripts/project/17.0.1.3/post-migration.py +++ b/openupgrade_scripts/scripts/project/17.0.1.3/post-migration.py @@ -188,10 +188,34 @@ def _fill_project_update_task_count(env): ) +def _convert_ir_ui_view_customs(env): + """ + Adapt custom views of project.task to the new model structure. + + Odoo 16.0 use the field `display_project_id` to show tasks in projects + 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%' + """, + ) + + @openupgrade.migrate() def migrate(env, version): _fill_project_task_display_in_project(env) _convert_project_task_repeat_type_after(env) + _convert_ir_ui_view_customs(env) openupgrade.load_data(env, "project", "17.0.1.3/noupdate_changes.xml") openupgrade.delete_record_translations( env.cr,