-
-
Notifications
You must be signed in to change notification settings - Fork 821
[MIG] event: Migration scripts #712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
129 changes: 129 additions & 0 deletions
129
addons/event/migrations/9.0.0.1/openupgrade_analysis_work.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| ---Fields in module 'event'--- | ||
| event / event.event / active (boolean) : NEW | ||
| # Nothing to do | ||
|
|
||
| event / event.event / badge_front (html) : NEW | ||
| # Nothing to do | ||
|
|
||
| event / event.event / color (integer) : NEW | ||
| # Nothing to do | ||
|
|
||
| event / event.event / country_id (many2one) : not a function anymore | ||
| # Nothing to do as country_id is now a related field from address_id | ||
|
|
||
| event / event.event / email_confirmation_id (many2one): DEL relation: email.template | ||
| # Column renamed to None to be preserved -> done | ||
|
|
||
| event / event.event / email_registration_id (many2one): DEL relation: email.template | ||
| # Done: created event.mail line for each email confirmation template | ||
|
|
||
| event / event.event / event_logo (html) : NEW | ||
| # Nothing to do | ||
|
|
||
| event / event.event / event_mail_ids (one2many) : NEW relation: event.mail | ||
| # Nothing to do | ||
|
|
||
| event / event.event / message_follower_ids (many2many): not a function anymore | ||
| event / event.event / message_follower_ids (many2many): relation is now 'mail.followers' ('res.partner') | ||
| event / event.event / message_follower_ids (many2many): type is now 'one2many' ('many2many') | ||
| # Concerns module Mail (has to be done in another migration script specifically for that module) ---> Nothing to do | ||
|
|
||
| event / event.event / seats_availability (selection): NEW required: required, selection_keys: ['limited', 'unlimited'], req_default: unlimited | ||
| # Updated from seats_max | ||
|
|
||
| event / event.event / type (many2one) : was renamed to event_type_id [nothing to to] | ||
| # Nothing to do | ||
|
|
||
| event / event.mail / event_id (many2one) : NEW relation: event.event, required: required | ||
| # Nothing to do: new relation | ||
|
|
||
| event / event.mail / interval_nbr (integer) : NEW | ||
| # Nothing to do: new relation | ||
|
|
||
| event / event.mail / interval_type (selection) : NEW required: required, selection_keys: ['after_event', 'after_sub', 'before_event'], req_default: before_event | ||
| # Nothing to do: new relation | ||
|
|
||
| event / event.mail / interval_unit (selection) : NEW required: required, selection_keys: ['days', 'hours', 'months', 'now', 'weeks'], req_default: hours | ||
| # Nothing to do: new relation | ||
|
|
||
| event / event.mail / mail_registration_ids (one2many): NEW relation: event.mail.registration | ||
| # Nothing to do: new relation | ||
|
|
||
| event / event.mail / mail_sent (boolean) : NEW | ||
| # Nothing to do: new relation | ||
|
|
||
| event / event.mail / sequence (integer) : NEW | ||
| # Nothing to do: new relation | ||
|
|
||
| event / event.mail / template_id (many2one) : NEW relation: mail.template, required: required | ||
| # Nothing to do: new relation | ||
|
|
||
| event / event.mail.registration / mail_sent (boolean) : NEW | ||
| # Nothing to do: new relation | ||
|
|
||
| event / event.mail.registration / registration_id (many2one) : NEW relation: event.registration, required: required | ||
| # Nothing to do: new relation | ||
|
|
||
| event / event.mail.registration / scheduler_id (many2one) : NEW relation: event.mail, required: required | ||
| # Nothing to do: new relation | ||
|
|
||
| event / event.registration / log_ids (one2many) : DEL relation: mail.message | ||
| # Nothing to do: new relation | ||
|
|
||
| event / event.registration / message_follower_ids (many2many): not a function anymore | ||
| event / event.registration / message_follower_ids (many2many): relation is now 'mail.followers' ('res.partner') | ||
| event / event.registration / message_follower_ids (many2many): type is now 'one2many' ('many2many') | ||
| # Concerns module Mail (has to be done in another migration script specifically for that module) ---> Nothing to do | ||
|
|
||
| event / event.registration / nb_register (integer) : DEL required: required, req_default: 1 | ||
| # Nothing to do: new relation | ||
|
|
||
| event / event.registration / user_id (many2one) : DEL relation: res.users | ||
| # Nothing to do: new relation | ||
|
|
||
| event / event.type / default_email_event (many2one): DEL relation: email.template | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do we put now default event.mail?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems this feature don't exist in version 9.0. |
||
| event / event.type / default_email_registration (many2one): DEL relation: email.template | ||
|
|
||
| event / res.partner / speaker (boolean) : DEL | ||
|
|
||
|
|
||
| ---XML records in module 'event'--- | ||
| DEL email.template: event.confirmation_event | ||
| DEL email.template: event.confirmation_registration | ||
| NEW ir.actions.act_window: event.act_event_registration_from_event | ||
| NEW ir.actions.act_window: event.action_event_configuration | ||
| NEW ir.actions.act_window: event.action_event_mail | ||
| DEL ir.actions.act_window: event.act_event_list_register_event | ||
| DEL ir.actions.act_window.view: event.action_report_event_registration_graph | ||
| NEW ir.actions.report.xml: event.report_event_event_badge | ||
| NEW ir.actions.report.xml: event.report_event_registration_badge | ||
| NEW ir.cron: event.event_mail_scheduler | ||
| NEW ir.model.access: event.access_event_mail | ||
| NEW ir.model.access: event.access_event_mail_manager | ||
| NEW ir.model.access: event.access_event_mail_registration | ||
| NEW ir.model.access: event.access_event_mail_registration_manager | ||
| DEL ir.module.category: event.module_category_event_management | ||
| NEW ir.ui.menu: event.menu_event_configuration | ||
| NEW ir.ui.menu: event.menu_event_global_settings | ||
| DEL ir.ui.menu: base.menu_marketing_config_root | ||
| DEL ir.ui.menu: base.menu_report_association | ||
| DEL ir.ui.menu: event.event_configuration | ||
| NEW ir.ui.view: event.event_event_report_template_badge | ||
| NEW ir.ui.view: event.event_registration_report_template_badge | ||
| NEW ir.ui.view: event.report_event_registration_pivot | ||
| NEW ir.ui.view: event.view_event_configuration | ||
| NEW ir.ui.view: event.view_event_mail_form | ||
| NEW ir.ui.view: event.view_event_mail_tree | ||
| NEW ir.ui.view: event.view_event_registration_pivot | ||
| DEL ir.ui.view: event.view_event_partner_info_form | ||
| DEL ir.values: event.default_value_event_mail_confirmation | ||
| DEL ir.values: event.default_value_registration_mail_confirmation | ||
| DEL mail.message.subtype: event.mt_event_registration | ||
| NEW mail.template: event.event_registration_mail_template_badge | ||
| NEW mail.template: event.event_reminder | ||
| NEW mail.template: event.event_subscription | ||
| NEW mail.template: event.event_thanks | ||
| NEW report.paperformat: event.paperformat_euro_lowmargin | ||
| NEW res.groups: event.group_email_scheduling | ||
| NEW web.tip: event.event_tip_1 | ||
| # Nothing to do | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # © 2016 Tecnativa - Vicent Cubells <vicent.cubells@tecnativa.com> | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
| from openupgradelib import openupgrade | ||
|
|
||
|
|
||
| def update_seats_availability(cr): | ||
| cr.execute(""" | ||
| UPDATE event_event | ||
| SET seats_availability = 'limited' | ||
| WHERE seats_max IS NOT NULL | ||
| """) | ||
| cr.execute(""" | ||
| UPDATE event_event | ||
| SET seats_availability = 'unlimited' | ||
| WHERE seats_max IS NULL OR seats_max = 0 | ||
| """) | ||
|
|
||
|
|
||
| def insert_confirmation_email(cr): | ||
| # Insert and save at least email registration templates although relations | ||
| # and models are changed in version 9.0 | ||
| cr.execute(""" | ||
| INSERT INTO event_mail | ||
| (event_id, interval_nbr, interval_unit, interval_type, template_id) | ||
| SELECT id, 1, 'now', 'after_sub', %(template_id)s | ||
| FROM event_event | ||
| WHERE %(template_id)s IS NOT NULL | ||
| """ % {'template_id': openupgrade.get_legacy_name('email_registration_id')} | ||
| ) | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(cr, version): | ||
| update_seats_availability(cr) | ||
| insert_confirmation_email(cr) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # © 2016 Tecnativa - Vicent Cubells <vicent.cubells@tecnativa.com> | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
| from openupgradelib import openupgrade | ||
|
|
||
|
|
||
| column_renames = { | ||
| 'event_event': [ | ||
| ('email_confirmation_id', None), | ||
| ('email_registration_id', None), | ||
| ], | ||
| 'event_type': [ | ||
| ('default_email_event', None), | ||
| ('default_email_registration', None), | ||
| ], | ||
| 'res_partner': [ | ||
| ('speaker', None), | ||
| ], | ||
| } | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(cr, version): | ||
| openupgrade.rename_columns(cr, column_renames) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the replacement of the two dissapeared fields with templates? Without looking the code or runbot, it seems this is a way to program reminders and steps to send emails in certain stages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it isn't. The field contains the template of the mail that will be automatically sent. It isn't the same that email_confirmation_id and email_registration_id fields.