From b8e3168eafbd9d3e7fd9f134c7cbbc3569bdf94e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Sainl=C3=A9ger?= Date: Wed, 15 Jul 2026 23:15:06 +0200 Subject: [PATCH] [FIX] project: drop ``project_list`` act_window_view before 17.0 migration ``project_list`` (OCA) is not ported to 17.0 and is merged into core: in 17.0 the core ``project`` module natively adds the kanban/tree views to the "Projects" actions (``act_window_id`` 149 & 760), and 17.0 introduces the constraint ``act_window_view_unique_mode_per_action = unique(act_window_id, view_mode)``. When core reloads ``project_project_views.xml`` it INSERTs its own ``(act_window_id, view_mode='kanban')`` rows, colliding with the rows still owned by ``project_list`` and aborting the registry load with a ``UniqueViolation`` on ``act_window_view_unique_mode_per_action``. Delete ``project_list``'s ``ir.actions.act_window.view`` records (and their ``ir_model_data``) in ``versions/17.0/pre_upgrade.sh`` so core can recreate its canonical rows. Verified against the 17.0 OpenUpgrade scripts: none reference ``project_list`` xml-ids nor remap these records, so this is safe. Scoped to ``ir.actions.act_window.view`` only, idempotent. --- versions/17.0/pre_upgrade.sh | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/versions/17.0/pre_upgrade.sh b/versions/17.0/pre_upgrade.sh index f5c8116..644145b 100755 --- a/versions/17.0/pre_upgrade.sh +++ b/versions/17.0/pre_upgrade.sh @@ -51,6 +51,58 @@ EOF echo "SQL command = $PRE_MIGRATE_SQL_3" query_postgres_container "$PRE_MIGRATE_SQL_3" ou17 || exit 1 +# ──────────────────────────────────────────────────────────── +# Remove project_list's ir.actions.act_window.view records +# +# `project_list` (OCA) is not ported to 17.0 and is classified as +# merged_in_core: in 17.0 the core `project` module natively adds the +# kanban/tree views to the "Projects" actions (act_window_id 149 & 760). +# 17.0 also introduces the unique constraint +# `act_window_view_unique_mode_per_action = unique(act_window_id, view_mode)`. +# +# When core reloads project_project_views.xml, it INSERTs its own +# (act_window_id, view_mode='kanban') rows, which collide with the rows still +# owned by project_list -> UniqueViolation, aborting the registry load: +# +# ERROR: duplicate key value violates unique constraint +# "act_window_view_unique_mode_per_action" +# DETAIL: Key (act_window_id, view_mode)=(760, kanban) already exists. +# +# We delete project_list's act_window_view rows (and their ir_model_data) so +# core can recreate its canonical rows. Verified against the 17.0 OpenUpgrade +# scripts: none reference project_list xmlids nor remap these records, so this +# is safe. Scoped to ir.actions.act_window.view only. Idempotent. +# ──────────────────────────────────────────────────────────── +PRE_MIGRATE_SQL_4=$(cat <<'EOF' +DO $$ +DECLARE + deleted_count INTEGER; +BEGIN + WITH targets AS ( + SELECT d.id AS imd_id, d.res_id AS awv_id + FROM ir_model_data d + WHERE d.module = 'project_list' + AND d.model = 'ir.actions.act_window.view' + ), + del_views AS ( + DELETE FROM ir_act_window_view + WHERE id IN (SELECT awv_id FROM targets) + RETURNING id + ), + del_imd AS ( + DELETE FROM ir_model_data + WHERE id IN (SELECT imd_id FROM targets) + RETURNING id + ) + SELECT count(*) INTO deleted_count FROM del_views; + + RAISE NOTICE 'Removed % project_list act_window_view record(s) to avoid act_window_view_unique_mode_per_action collision', deleted_count; +END $$; +EOF +) +echo "SQL command = $PRE_MIGRATE_SQL_4" +query_postgres_container "$PRE_MIGRATE_SQL_4" ou17 || exit 1 + # Copy filestores copy_filestore ou16 ou16 ou17 ou17 || exit 1