Skip to content

Commit

Permalink
Merge pull request #2265 from ForgeFlow/13.0-mig-calendar-script
Browse files Browse the repository at this point in the history
[13.0][MIG] calendar
  • Loading branch information
pedrobaeza authored Apr 11, 2020
2 parents f3bac82 + 3110d99 commit d460357
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 15 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
16 changes: 16 additions & 0 deletions addons/calendar/migrations/13.0.1.0/openupgrade_analysis_work.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---Models in module 'calendar'---
---Fields in module 'calendar'---
calendar / calendar.alarm / alarm_type (selection) : NEW required, selection_keys: ['email', 'notification'], req_default: function, hasdefault
calendar / calendar.alarm / type (selection) : DEL required, selection_keys: ['email', 'notification'], req_default: function
# DONE: pre-migration: renamed fields

calendar / calendar.event / event_tz (selection) : NEW selection_keys: function, hasdefault
# NOTHING TO DO: New field that has default, will be automatically filled

calendar / mail.activity.type / category (False) : selection_keys is now '['default', 'meeting', 'upload_file']' ('['default', 'meeting']')
# NOTHING TO DO: new features

---XML records in module 'calendar'---
DEL ir.ui.view: calendar.mail_activity_type_view_form
DEL ir.ui.view: calendar.view_calendar_event_form_popup
# NOTHING TO DO
20 changes: 20 additions & 0 deletions addons/calendar/migrations/13.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +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')
13 changes: 13 additions & 0 deletions addons/calendar/migrations/13.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2020 ForgeFlow <http://www.forgeflow.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade

_field_renames = [
('calendar.alarm ', 'calendar_alarm ', 'type', 'alarm_type'),
]


@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_fields(env, _field_renames)
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 @@ -97,7 +97,7 @@ missing in the new release are marked with |del|.
+----------------------------------------------+-------------------------------------------------+
|bus | Nothing to do |
+----------------------------------------------+-------------------------------------------------+
|calendar | |
|calendar | Done |
+----------------------------------------------+-------------------------------------------------+
|calendar_sms | |
+----------------------------------------------+-------------------------------------------------+
Expand Down

0 comments on commit d460357

Please sign in to comment.