From 48ce6087e3914eed7a60bfa7ab66cee01bb9fc54 Mon Sep 17 00:00:00 2001
From: pilarvargas-tecnativa <pilar.vargas@tecnativa.com>
Date: Tue, 26 Nov 2024 16:46:42 +0100
Subject: [PATCH] [OU-ADD] website_event: Migration scripts

TT51546
---
 docsource/modules160-170.rst                  |  2 +-
 .../website_event/17.0.1.4/post-migration.py  |  8 ++
 .../website_event/17.0.1.4/pre-migration.py   | 30 ++++++
 .../17.0.1.4/upgrade_analysis_work.txt        | 96 +++++++++++++++++++
 4 files changed, 135 insertions(+), 1 deletion(-)
 create mode 100644 openupgrade_scripts/scripts/website_event/17.0.1.4/post-migration.py
 create mode 100644 openupgrade_scripts/scripts/website_event/17.0.1.4/pre-migration.py
 create mode 100644 openupgrade_scripts/scripts/website_event/17.0.1.4/upgrade_analysis_work.txt

diff --git a/docsource/modules160-170.rst b/docsource/modules160-170.rst
index fc3b300c0d95..db7a0fa509a9 100644
--- a/docsource/modules160-170.rst
+++ b/docsource/modules160-170.rst
@@ -1030,7 +1030,7 @@ Module coverage 16.0 -> 17.0
 +---------------------------------------------------+----------------------+-------------------------------------------------+
 | website_customer                                  |                      |                                                 |
 +---------------------------------------------------+----------------------+-------------------------------------------------+
-| website_event                                     |                      |                                                 |
+| website_event                                     | Done                 |                                                 |
 +---------------------------------------------------+----------------------+-------------------------------------------------+
 | website_event_booth                               |                      |                                                 |
 +---------------------------------------------------+----------------------+-------------------------------------------------+
diff --git a/openupgrade_scripts/scripts/website_event/17.0.1.4/post-migration.py b/openupgrade_scripts/scripts/website_event/17.0.1.4/post-migration.py
new file mode 100644
index 000000000000..36229add0432
--- /dev/null
+++ b/openupgrade_scripts/scripts/website_event/17.0.1.4/post-migration.py
@@ -0,0 +1,8 @@
+# Copyright 2024 Tecnativa - Pilar Vargas
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+from openupgradelib import openupgrade
+
+
+@openupgrade.migrate()
+def migrate(env, version):
+    openupgrade.load_data(env, "website_event", "17.0.1.4/noupdate_changes.xml")
diff --git a/openupgrade_scripts/scripts/website_event/17.0.1.4/pre-migration.py b/openupgrade_scripts/scripts/website_event/17.0.1.4/pre-migration.py
new file mode 100644
index 000000000000..21fdb96a730a
--- /dev/null
+++ b/openupgrade_scripts/scripts/website_event/17.0.1.4/pre-migration.py
@@ -0,0 +1,30 @@
+# Copyright 2024 Tecnativa - Pilar Vargas
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+from openupgradelib import openupgrade
+
+_xmlids_renames = [
+    (
+        "website_event.constraint_event_registration_answer_value_check",
+        "website_event.constraint_event_registration_answer_value_check",
+    ),
+    (
+        "website_event.ir_rule_event_question_answer_event_user",
+        "website_event.ir_rule_event_question_answer_event_user",
+    ),
+    (
+        "website_event.ir_rule_event_question_answer_published",
+        "website_event.ir_rule_event_question_answer_published",
+    ),
+    (
+        "website_event.ir_rule_event_question_event_user",
+        "website_event.ir_rule_event_question_event_user",
+    ),
+    (
+        "website_event.ir_rule_event_question_published",
+        "website_event.ir_rule_event_question_published",
+    ),
+]
+
+
+def migrate(cr, version):
+    openupgrade.rename_xmlids(cr, _xmlids_renames)
diff --git a/openupgrade_scripts/scripts/website_event/17.0.1.4/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/website_event/17.0.1.4/upgrade_analysis_work.txt
new file mode 100644
index 000000000000..ed3167d517b9
--- /dev/null
+++ b/openupgrade_scripts/scripts/website_event/17.0.1.4/upgrade_analysis_work.txt
@@ -0,0 +1,96 @@
+---Models in module 'website_event'---
+---Fields in module 'website_event'---
+website_event / event.registration       / registration_answer_choice_ids (one2many): NEW relation: event.registration.answer
+website_event / event.tag                / is_published (boolean)        : NEW hasdefault: default
+website_event / event.tag                / website_id (many2one)         : NEW relation: website
+website_event / event.tag.category       / website_id (many2one)         : NEW relation: website
+website_event / event.tag.category       / website_published (boolean)   : not related anymore
+website_event / event.tag.category       / website_published (boolean)   : now a function
+website_event_questions / event.question           / question_type (selection)     : selection_keys is now '['company_name', 'email', 'name', 'phone', 'simple_choice', 'text_box']' ('['simple_choice', 'text_box']')
+# NOTHING TO DO
+
+---XML records in module 'website_event'---
+NEW ir.actions.act_window: website_event.action_event_registration_report [renamed from website_event_questions module]
+DEL ir.actions.act_window: website_event_questions.action_event_registration_report [renamed to website_event module]
+# NOTHING TO DO
+
+NEW ir.asset: website_event.s_searchbar_000_js
+NEW ir.asset: website_event.s_searchbar_000_xml
+# NOTHING TO DO
+
+NEW ir.model.access: website_event.access_event_event_employee
+NEW ir.model.access: website_event.access_event_event_portal
+NEW ir.model.access: website_event.access_event_event_public
+NEW ir.model.access: website_event.access_event_event_ticket_employee
+NEW ir.model.access: website_event.access_event_event_ticket_portal
+NEW ir.model.access: website_event.access_event_event_ticket_public
+NEW ir.model.access: website_event.access_event_question_answer_employee
+NEW ir.model.access: website_event.access_event_question_answer_portal
+NEW ir.model.access: website_event.access_event_question_answer_public
+NEW ir.model.access: website_event.access_event_question_answer_registration [renamed from website_event_questions module]
+NEW ir.model.access: website_event.access_event_question_answer_user [renamed from website_event_questions module]
+NEW ir.model.access: website_event.access_event_question_employee
+NEW ir.model.access: website_event.access_event_question_portal
+NEW ir.model.access: website_event.access_event_question_public
+NEW ir.model.access: website_event.access_event_question_user [renamed from website_event_questions module]
+NEW ir.model.access: website_event.access_event_registration_answer
+NEW ir.model.access: website_event.access_event_tag_category_employee
+NEW ir.model.access: website_event.access_event_tag_category_portal
+NEW ir.model.access: website_event.access_event_tag_category_public
+NEW ir.model.access: website_event.access_event_tag_employee
+NEW ir.model.access: website_event.access_event_tag_portal
+NEW ir.model.access: website_event.access_event_tag_public
+NEW ir.model.access: website_event.access_website_event_menu_employee
+NEW ir.model.access: website_event.access_website_event_menu_portal
+NEW ir.model.access: website_event.access_website_event_menu_public
+DEL ir.model.access: website_event.access_event_event
+DEL ir.model.access: website_event.access_event_event_ticket
+DEL ir.model.access: website_event.access_event_tag
+DEL ir.model.access: website_event.access_event_tag_category
+DEL ir.model.access: website_event.access_website_event_menu
+DEL ir.model.access: website_event_questions.access_event_question
+DEL ir.model.access: website_event_questions.access_event_question_answer
+DEL ir.model.access: website_event_questions.access_event_question_answer_registration [renamed to website_event module]
+DEL ir.model.access: website_event_questions.access_event_question_answer_user [renamed to website_event module]
+DEL ir.model.access: website_event_questions.access_event_question_user [renamed to website_event module]
+DEL ir.model.access: website_event_questions.access_event_registration_answer_registration
+# NOTHING TO DO
+
+NEW ir.model.constraint: website_event.constraint_event_registration_answer_value_check [renamed from website_event_questions module]
+DEL ir.model.constraint: website_event_questions.constraint_event_registration_answer_value_check [renamed to website_event module]
+NEW ir.rule: website_event.ir_rule_event_question_answer_event_user [renamed from website_event_questions module] (noupdate)
+NEW ir.rule: website_event.ir_rule_event_question_answer_published [renamed from website_event_questions module] (noupdate)
+NEW ir.rule: website_event.ir_rule_event_question_event_user [renamed from website_event_questions module] (noupdate)
+NEW ir.rule: website_event.ir_rule_event_question_published [renamed from website_event_questions module] (noupdate)
+DEL ir.rule: website_event_questions.ir_rule_event_question_answer_event_user [renamed to website_event module] (noupdate)
+DEL ir.rule: website_event_questions.ir_rule_event_question_answer_published [renamed to website_event module] (noupdate)
+DEL ir.rule: website_event_questions.ir_rule_event_question_event_user [renamed to website_event module] (noupdate)
+DEL ir.rule: website_event_questions.ir_rule_event_question_published [renamed to website_event module] (noupdate)
+# DONE: renamed in pre-migration
+
+NEW ir.ui.view: website_event.event_empty_events_svg
+NEW ir.ui.view: website_event.event_question_view_form
+NEW ir.ui.view: website_event.event_registration_answer_view_graph
+NEW ir.ui.view: website_event.event_registration_answer_view_pivot
+NEW ir.ui.view: website_event.event_registration_answer_view_search
+NEW ir.ui.view: website_event.event_registration_answer_view_tree
+NEW ir.ui.view: website_event.event_registration_view_kanban
+NEW ir.ui.view: website_event.event_registration_view_search
+NEW ir.ui.view: website_event.event_tag_view_form_inherit
+NEW ir.ui.view: website_event.modal_ticket_registration
+NEW ir.ui.view: website_event.navbar
+NEW ir.ui.view: website_event.registration_event_question
+DEL ir.ui.view: website_event.fold_register_details
+DEL ir.ui.view: website_event.res_config_settings_view_form
+DEL ir.ui.view: website_event_questions.event_event_view_form
+DEL ir.ui.view: website_event_questions.event_question_view_form
+DEL ir.ui.view: website_event_questions.event_registration_answer_view_graph
+DEL ir.ui.view: website_event_questions.event_registration_answer_view_pivot
+DEL ir.ui.view: website_event_questions.event_registration_answer_view_search
+DEL ir.ui.view: website_event_questions.event_registration_answer_view_tree
+DEL ir.ui.view: website_event_questions.event_registration_view_form_inherit_question
+DEL ir.ui.view: website_event_questions.event_registration_view_tree
+DEL ir.ui.view: website_event_questions.event_type_view_form_inherit_question
+DEL ir.ui.view: website_event_questions.registration_attendee_details_questions
+DEL ir.ui.view: website_event_questions.registration_event_question
+# NOTHING TO DO
