Skip to content

Commit

Permalink
[FIX] calendar: Several fixes
Browse files Browse the repository at this point in the history
* Don't overwrite renamed field `alarm_type` in noupdate changes.
* Make sure `event_tz` field is empty for preserving previous behavior.
  • Loading branch information
pedrobaeza committed Apr 11, 2020
1 parent 4e8878b commit 3110d99
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
28 changes: 14 additions & 14 deletions addons/calendar/migrations/13.0.1.0/noupdate_changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@
<odoo>
<record id="alarm_mail_1" model="calendar.alarm">
<field name="name">Email - 3 Hours</field>
<!-- <field name="type"/>-->
<field name="alarm_type">email</field>
<!-- <field name="type"/>
<field name="alarm_type">email</field>-->
</record>
<record id="alarm_mail_2" model="calendar.alarm">
<field name="name">Email - 6 Hours</field>
<!-- <field name="type"/>-->
<field name="alarm_type">email</field>
<!-- <field name="type"/>
<field name="alarm_type">email</field>-->
</record>
<record id="alarm_notif_1" model="calendar.alarm">
<field name="name">Notification - 15 Minutes</field>
<!-- <field name="type"/>-->
<field name="alarm_type">notification</field>
<!-- <field name="type"/>
<field name="alarm_type">notification</field>-->
</record>
<record id="alarm_notif_2" model="calendar.alarm">
<field name="name">Notification - 30 Minutes</field>
<!-- <field name="type"/>-->
<field name="alarm_type">notification</field>
<!-- <field name="type"/>
<field name="alarm_type">notification</field>-->
</record>
<record id="alarm_notif_3" model="calendar.alarm">
<field name="name">Notification - 1 Hours</field>
<!-- <field name="type"/>-->
<field name="alarm_type">notification</field>
<!-- <field name="type"/>
<field name="alarm_type">notification</field>-->
</record>
<record id="alarm_notif_4" model="calendar.alarm">
<field name="name">Notification - 2 Hours</field>
<!-- <field name="type"/>-->
<field name="alarm_type">notification</field>
<!-- <field name="type"/>
<field name="alarm_type">notification</field>-->
</record>
<record id="alarm_notif_5" model="calendar.alarm">
<field name="name">Notification - 1 Days</field>
<!-- <field name="type"/>-->
<field name="alarm_type">notification</field>
<!-- <field name="type"/>
<field name="alarm_type">notification</field>-->
</record>
<record id="calendar_template_meeting_changedate" model="mail.template">
<field name="email_from">${(object.event_id.user_id.email_formatted or user.email_formatted or '') | safe}</field>
Expand Down
10 changes: 10 additions & 0 deletions addons/calendar/migrations/13.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# Copyright 2020 ForgeFlow <http://www.forgeflow.com>
# Copyright 2020 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade


def _empty_calendar_event_tz(env):
"""Make sure event tz is empty for equal behavior as in v12."""
openupgrade.logged_query(
env.cr,
"UPDATE calendar_event set event_tz = NULL WHERE event_tz IS NOT NULL",
)


@openupgrade.migrate()
def migrate(env, version):
_empty_calendar_event_tz(env)
openupgrade.load_data(
env.cr, 'calendar', 'migrations/13.0.1.0/noupdate_changes.xml')

0 comments on commit 3110d99

Please sign in to comment.