diff --git a/addons/website_event_track/migrations/13.0.1.0/openupgrade_analysis_work.txt b/addons/website_event_track/migrations/13.0.1.0/openupgrade_analysis_work.txt new file mode 100644 index 000000000000..d25bf8173d23 --- /dev/null +++ b/addons/website_event_track/migrations/13.0.1.0/openupgrade_analysis_work.txt @@ -0,0 +1,13 @@ +---Models in module 'website_event_track'--- +---Fields in module 'website_event_track'--- +website_event_track / event.sponsor / image_128 (binary) : NEW attachment: True, isrelated: related, stored +website_event_track / event.sponsor / image_medium (binary) : DEL attachment: True +# DONE: pre-migration: renamed + +website_event_track / event.track / date_end (datetime) : NEW isfunction: function, stored +# NOTHING TO DO + +website_event_track / event.track.tag / name (char) : now required +# DONE: post-migration: assure is filled + +---XML records in module 'website_event_track'--- diff --git a/addons/website_event_track/migrations/13.0.1.0/post-migration.py b/addons/website_event_track/migrations/13.0.1.0/post-migration.py new file mode 100644 index 000000000000..2fa2e1d2ef00 --- /dev/null +++ b/addons/website_event_track/migrations/13.0.1.0/post-migration.py @@ -0,0 +1,25 @@ +# Copyright 2020 ForgeFlow +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openupgradelib import openupgrade + + +def fill_event_track_tag_name(env): + openupgrade.logged_query( + env.cr, """ + UPDATE event_track_tag + SET name = 'default_name_' || id + WHERE name IS NULL""", + ) + + +@openupgrade.migrate() +def migrate(env, version): + fill_event_track_tag_name(env) + openupgrade.load_data( + env.cr, "website_event_track", + "migrations/13.0.1.0/noupdate_changes.xml") + openupgrade.delete_record_translations( + env.cr, 'website_event_track', [ + 'mail_template_data_track_confirmation', + ], + ) diff --git a/addons/website_event_track/migrations/13.0.1.0/pre-migration.py b/addons/website_event_track/migrations/13.0.1.0/pre-migration.py new file mode 100644 index 000000000000..6d970cc450e8 --- /dev/null +++ b/addons/website_event_track/migrations/13.0.1.0/pre-migration.py @@ -0,0 +1,18 @@ +# Copyright 2020 ForgeFlow +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openupgradelib import openupgrade + + +def rename_image_attachments(env): + for old, new in [("image_medium", "image_128")]: + openupgrade.logged_query( + env.cr, """ + UPDATE ir_attachment SET res_field = %s + WHERE res_field = %s AND res_model = 'event.sponsor'""", + (new, old), + ) + + +@openupgrade.migrate() +def migrate(env, version): + rename_image_attachments(env) diff --git a/odoo/openupgrade/doc/source/modules120-130.rst b/odoo/openupgrade/doc/source/modules120-130.rst index de2554b3ec0e..4e6662326737 100644 --- a/odoo/openupgrade/doc/source/modules120-130.rst +++ b/odoo/openupgrade/doc/source/modules120-130.rst @@ -675,7 +675,7 @@ missing in the new release are marked with |del|. +----------------------------------------------+-------------------------------------------------+ |website_event_sale | | +----------------------------------------------+-------------------------------------------------+ -|website_event_track | | +|website_event_track | Done | +----------------------------------------------+-------------------------------------------------+ |website_form | Done | +----------------------------------------------+-------------------------------------------------+