diff --git a/docsource/modules180-190.rst b/docsource/modules180-190.rst index e6116249b48e..f77f7e849adb 100644 --- a/docsource/modules180-190.rst +++ b/docsource/modules180-190.rst @@ -1128,7 +1128,7 @@ Module coverage 18.0 -> 19.0 +---------------------------------------------------+----------------------+-------------------------------------------------+ | website |Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ -| website_blog | | | +| website_blog |Done | | +---------------------------------------------------+----------------------+-------------------------------------------------+ | website_cf_turnstile | | | +---------------------------------------------------+----------------------+-------------------------------------------------+ diff --git a/openupgrade_scripts/scripts/website_blog/19.0.1.1/post-migration.py b/openupgrade_scripts/scripts/website_blog/19.0.1.1/post-migration.py new file mode 100644 index 000000000000..5e80aa0f84fa --- /dev/null +++ b/openupgrade_scripts/scripts/website_blog/19.0.1.1/post-migration.py @@ -0,0 +1,15 @@ +# Copyright 2026 Tecnativa - Carlos Lopez +# 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_blog", "19.0.1.1/noupdate_changes.xml") + openupgrade.delete_record_translations( + env.cr, + "website_blog", + ["blog_post_template_new_post"], + ["arch_db"], + ) diff --git a/openupgrade_scripts/scripts/website_blog/19.0.1.1/pre-migration.py b/openupgrade_scripts/scripts/website_blog/19.0.1.1/pre-migration.py new file mode 100644 index 000000000000..dd7f2cdd4cc3 --- /dev/null +++ b/openupgrade_scripts/scripts/website_blog/19.0.1.1/pre-migration.py @@ -0,0 +1,68 @@ +# Copyright 2026 Tecnativa - Carlos Lopez +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from openupgradelib import openupgrade + +_new_columns = [ + ("blog.blog", "sequence", "integer", None, "blog_blog"), + ("blog.blog", "is_seo_optimized", "boolean", False, "blog_blog"), + ("blog.post", "is_seo_optimized", "boolean", False, "blog_post"), + ("blog.tag", "is_seo_optimized", "boolean", False, "blog_tag"), +] + + +def _fill_blog_is_seo_optimized(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE blog_blog + 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.logged_query( + env.cr, + """ + UPDATE blog_post + 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.logged_query( + env.cr, + """ + UPDATE blog_tag + 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 + """, + ) + + +def _fill_blog_blog_sequence(env): + openupgrade.logged_query( + env.cr, + """ + UPDATE blog_blog AS bb + SET sequence = sequence_data.sequence + FROM ( + SELECT + id, + row_number() OVER (ORDER BY create_date ASC, id ASC) AS sequence + FROM blog_blog + ) AS sequence_data + WHERE bb.id = sequence_data.id + """, + ) + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.add_columns(env, _new_columns) + _fill_blog_is_seo_optimized(env) + _fill_blog_blog_sequence(env) diff --git a/openupgrade_scripts/scripts/website_blog/19.0.1.1/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/website_blog/19.0.1.1/upgrade_analysis_work.txt new file mode 100644 index 000000000000..10fac904b03c --- /dev/null +++ b/openupgrade_scripts/scripts/website_blog/19.0.1.1/upgrade_analysis_work.txt @@ -0,0 +1,48 @@ +---Models in module 'website_blog'--- +---Fields in module 'website_blog'--- +website_blog / blog.blog / is_seo_optimized (boolean) : is now stored +website_blog / blog.post / is_seo_optimized (boolean) : is now stored +website_blog / blog.tag / is_seo_optimized (boolean) : is now stored +# DONE: pre-migration: Pre-created and populated these fields. + +website_blog / blog.blog / sequence (integer) : NEW hasdefault: default +# DONE: pre-migration: Pre-created and populated this field to preserve the old order ORDER BY create_date ASC, id ASC. + +website_blog / blog.post / footer_visible (boolean) : NEW hasdefault: default +website_blog / blog.post / header_visible (boolean) : NEW hasdefault: default +# NOTHING TO DO: The fields are created by inheriting website.page_visibility_options.mixin. + +---XML records in module 'website_blog'--- +NEW ir.ui.view: website_blog.blog_post_info +NEW ir.ui.view: website_blog.dynamic_filter_template_blog_post_single_aside +NEW ir.ui.view: website_blog.dynamic_filter_template_blog_post_single_badge +NEW ir.ui.view: website_blog.dynamic_filter_template_blog_post_single_circle +NEW ir.ui.view: website_blog.dynamic_filter_template_blog_post_single_full +NEW ir.ui.view: website_blog.s_blog_posts_big_picture +NEW ir.ui.view: website_blog.s_blog_posts_card +NEW ir.ui.view: website_blog.s_blog_posts_horizontal +NEW ir.ui.view: website_blog.s_blog_posts_list +NEW ir.ui.view: website_blog.s_blog_posts_single_aside +NEW ir.ui.view: website_blog.s_blog_posts_single_badge +NEW ir.ui.view: website_blog.s_blog_posts_single_circle +NEW ir.ui.view: website_blog.s_blog_posts_single_full +NEW ir.ui.view: website_blog.s_dynamic_snippet_blog_posts_card_preview_data +NEW ir.ui.view: website_blog.s_dynamic_snippet_blog_posts_horizontal_preview_data +NEW ir.ui.view: website_blog.s_dynamic_snippet_blog_posts_list_preview_data +NEW ir.ui.view: website_blog.s_dynamic_snippet_blog_posts_single_aside_preview_data +NEW ir.ui.view: website_blog.s_dynamic_snippet_blog_posts_single_badge_preview_data +NEW ir.ui.view: website_blog.s_dynamic_snippet_blog_posts_single_circle_preview_data +NEW ir.ui.view: website_blog.s_dynamic_snippet_blog_posts_single_full_preview_data +NEW ir.ui.view: website_blog.s_dynamic_snippet_template_category +# NOTHING TO DO: New feature + +DEL ir.ui.view: website_blog.opt_blog_post_select_to_comment +DEL ir.ui.view: website_blog.opt_blog_post_select_to_tweet +# NOTHING TO DO: Odoo removed this in https://github.com/odoo/odoo/pull/178568 + +DEL ir.ui.view: website_blog.blog_searchbar_input_snippet_options +DEL ir.ui.view: website_blog.s_blog_posts_options +DEL ir.ui.view: website_blog.s_dynamic_snippet_options_template +DEL ir.ui.view: website_blog.snippet_options +DEL ir.asset: website_blog.s_blog_posts_000_js +# NOTHING TO DO: Handled by ORM