Skip to content

Commit

Permalink
[MIG] website_event_track
Browse files Browse the repository at this point in the history
  • Loading branch information
MiquelRForgeFlow committed Jul 22, 2021
1 parent 6e2a1f7 commit 946b12e
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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'---
25 changes: 25 additions & 0 deletions addons/website_event_track/migrations/13.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2020 ForgeFlow <http://www.forgeflow.com>
# 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',
],
)
18 changes: 18 additions & 0 deletions addons/website_event_track/migrations/13.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2020 ForgeFlow <http://www.forgeflow.com>
# 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)
2 changes: 1 addition & 1 deletion odoo/openupgrade/doc/source/modules120-130.rst
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ missing in the new release are marked with |del|.
+----------------------------------------------+-------------------------------------------------+
|website_event_sale | |
+----------------------------------------------+-------------------------------------------------+
|website_event_track | |
|website_event_track | Done |
+----------------------------------------------+-------------------------------------------------+
|website_form | Done |
+----------------------------------------------+-------------------------------------------------+
Expand Down

0 comments on commit 946b12e

Please sign in to comment.