Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docsource/modules180-190.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ Module coverage 18.0 -> 19.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| website |Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| website_blog | | |
| website_blog |Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| website_cf_turnstile | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
Original file line number Diff line number Diff line change
@@ -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"],
)
68 changes: 68 additions & 0 deletions openupgrade_scripts/scripts/website_blog/19.0.1.1/pre-migration.py
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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
Loading