diff --git a/docsource/modules180-190.rst b/docsource/modules180-190.rst index a4aae335164f..692b6405abbb 100644 --- a/docsource/modules180-190.rst +++ b/docsource/modules180-190.rst @@ -1174,7 +1174,7 @@ Module coverage 18.0 -> 19.0 +---------------------------------------------------+----------------------+-------------------------------------------------+ | website_event_track_quiz | |No DB layout changes. | +---------------------------------------------------+----------------------+-------------------------------------------------+ -| website_forum | | | +| website_forum |Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ | website_google_map |Nothing to do | | +---------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/website_forum/19.0.1.2/post-migration.py b/openupgrade_scripts/scripts/website_forum/19.0.1.2/post-migration.py new file mode 100644 index 000000000000..0b2ddad633de --- /dev/null +++ b/openupgrade_scripts/scripts/website_forum/19.0.1.2/post-migration.py @@ -0,0 +1,19 @@ +# Copyright 2026 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_forum", "19.0.1.2/noupdate_changes.xml") + openupgrade.delete_record_translations( + env.cr, + "website_forum", + [ + "forum_post_template_new_answer", + "forum_post_template_new_question", + "forum_post_template_validation", + ], + ["arch_db"], + ) diff --git a/openupgrade_scripts/scripts/website_forum/19.0.1.2/pre-migration.py b/openupgrade_scripts/scripts/website_forum/19.0.1.2/pre-migration.py new file mode 100644 index 000000000000..ab79cadb743c --- /dev/null +++ b/openupgrade_scripts/scripts/website_forum/19.0.1.2/pre-migration.py @@ -0,0 +1,31 @@ +# Copyright 2026 Tecnativa - Pilar Vargas +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + + +def _precompute_is_seo_optimized(env, model_name, table_name): + openupgrade.add_columns( + env, + [(model_name, "is_seo_optimized", "boolean", False, table_name)], + ) + openupgrade.logged_query( + env.cr, + f""" + UPDATE {table_name} + SET is_seo_optimized = TRUE + WHERE website_meta_title IS NOT NULL + AND website_meta_description IS NOT NULL + AND website_meta_keywords IS NOT NULL + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + for model_name, table_name in [ + ("forum.forum", "forum_forum"), + ("forum.post", "forum_post"), + ("forum.tag", "forum_tag"), + ]: + _precompute_is_seo_optimized(env, model_name, table_name) diff --git a/openupgrade_scripts/scripts/website_forum/19.0.1.2/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/website_forum/19.0.1.2/upgrade_analysis_work.txt new file mode 100644 index 000000000000..4ce374381f8e --- /dev/null +++ b/openupgrade_scripts/scripts/website_forum/19.0.1.2/upgrade_analysis_work.txt @@ -0,0 +1,21 @@ +---Models in module 'website_forum'--- +# NOTHING TO DO + +---Fields in module 'website_forum'--- +website_forum / forum.forum / teaser (text) : DEL +# NOTHING TO DO + +website_forum / forum.forum / is_seo_optimized (boolean) : is now stored +website_forum / forum.post / is_seo_optimized (boolean) : is now stored +website_forum / forum.tag / is_seo_optimized (boolean) : is now stored +# DONE: pre-migration precomputes stored is_seo_optimized values from existing SEO metadata + +---XML records in module 'website_forum'--- +DEL ir.model.access: website_forum.access_forum_post_vote_public +NEW ir.rule: website_forum.website_forum_post_vote_all (noupdate) +NEW ir.rule: website_forum.website_forum_post_vote_own (noupdate) +DEL ir.ui.view: website_forum.forum_searchbar_input_snippet_options +DEL ir.ui.view: website_forum.snippet_options +DEL ir.ui.view: website_forum.user_profile_sub_nav +DEL ir.ui.view: website_forum.view_users_form_forum +# NOTHING TO DO: noupdate changes are handled automatically.