-
-
Notifications
You must be signed in to change notification settings - Fork 784
[17.0][OU-ADD] event: Migration scripts #4663
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Copyright 2024 Tecnativa - Víctor Martínez | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
| from openupgradelib import openupgrade | ||
|
|
||
| _deleted_xml_records = [ | ||
| "event.event_type_data_conference", | ||
| "event.event_type_data_ticket", | ||
| ] | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.load_data(env, "event", "17.0.1.8/noupdate_changes.xml") | ||
| openupgrade.delete_records_safely_by_xml_id( | ||
| env, | ||
| _deleted_xml_records, | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Copyright 2024 Tecnativa - Víctor Martínez | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
| from openupgradelib import openupgrade | ||
|
|
||
|
|
||
| def _fill_event_registration_company_name(env): | ||
| openupgrade.logged_query( | ||
| env.cr, | ||
| """ | ||
| ALTER TABLE event_registration | ||
| ADD COLUMN IF NOT EXISTS company_name VARCHAR | ||
| """, | ||
| ) | ||
| openupgrade.logged_query( | ||
| env.cr, | ||
| """UPDATE event_registration AS r | ||
| SET company_name = p.company_name | ||
| FROM res_partner AS p | ||
| WHERE r.partner_id IS NOT NULL | ||
| AND p.type = 'contact' | ||
| AND p.company_name IS NOT NULL;""", | ||
| ) | ||
| openupgrade.logged_query( | ||
| env.cr, | ||
| """UPDATE event_registration AS r | ||
| SET company_name = p2.company_name | ||
| FROM res_partner AS p | ||
| JOIN res_partner AS p2 ON (p2.parent_id = p.id AND p2.type = 'contact') | ||
| WHERE r.partner_id IS NOT NULL | ||
| AND p2.company_name IS NOT NULL | ||
| AND r.company_name IS NULL;""", | ||
| ) | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| _fill_event_registration_company_name(env) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| ---Models in module 'event'--- | ||
| ---Fields in module 'event'--- | ||
| event / event.event / _order : _order is now 'date_begin, id' ('date_begin') | ||
| event / event.event / activity_user_id (many2one) : not related anymore | ||
| event / event.event / activity_user_id (many2one) : now a function | ||
| # NOTHING TO DO | ||
| event / event.event / auto_confirm (boolean) : DEL | ||
victoralmau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # NOTHING TO DO: Attendees are now created confirmed (state=open) | ||
| event / event.event / badge_format (selection) : NEW required, selection_keys: ['A4_french_fold', 'A6', 'four_per_sheet'], hasdefault: default | ||
victoralmau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| event / event.event / badge_image (binary) : NEW attachment: True | ||
| # NOTHING TO DO | ||
| event / event.event / lang (selection) : NEW selection_keys: function | ||
| # NOTHING TO DO: It is not required, it can be empty, we do not set the value of the old records | ||
| event / event.event / message_main_attachment_id (many2one): DEL relation: ir.attachment | ||
| event / event.event / rating_ids (one2many) : NEW relation: rating.rating | ||
| event / event.event / registration_properties_definition (properties_definition): NEW | ||
| # NOTHING TO DO | ||
| event / event.event.ticket / _order : _order is now 'event_id, sequence, name, id' ('id') | ||
| event / event.event.ticket / color (char) : NEW hasdefault: default | ||
|
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 was the colors handled previously? All the tickets with the same color are OK?
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. Before there was no color, and now it is not used anywhere except in the event form view to define the tickets (i have not seen it used elsewhere). Also, defining random colors I don't think was a good decision either.
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 this works if you create the same tickets in this version?
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. |
||
| event / event.event.ticket / sequence (integer) : NEW hasdefault: default | ||
victoralmau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # NOTHING TO DO | ||
| event / event.registration / activity_user_id (many2one) : not related anymore | ||
| event / event.registration / activity_user_id (many2one) : now a function | ||
| # NOTHING TO DO | ||
| event / event.registration / barcode (char) : NEW | ||
| # NOTHING TO DO: There is no correct way to do it in postgres, we let the ORM set the value of the old records | ||
| event / event.registration / company_name (char) : NEW hasdefault: compute | ||
| # DONE: Define the value of existing records in pre-migration | ||
victoralmau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| event / event.registration / message_main_attachment_id (many2one): DEL relation: ir.attachment | ||
| event / event.registration / mobile (char) : DEL | ||
| event / event.registration / rating_ids (one2many) : NEW relation: rating.rating | ||
| event / event.registration / registration_properties (properties): NEW hasdefault: compute | ||
| # NOTHING TO DO | ||
| event / event.type / auto_confirm (boolean) : DEL | ||
| # NOTHING TO DO: Explained in auto_confirm field of event.event | ||
| event / event.type.ticket / _order : _order is now 'sequence, name, id' ('id') | ||
| event / event.type.ticket / sequence (integer) : NEW hasdefault: default | ||
victoralmau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # NOTHING TO DO | ||
| ---XML records in module 'event'--- | ||
| DEL event.type: event.event_type_data_conference (noupdate) | ||
| DEL event.type: event.event_type_data_ticket (noupdate) | ||
| # DONE: removed in post-migration | ||
| NEW ir.actions.client: event.event_barcode_action_main_view | ||
| NEW ir.actions.report: event.action_report_event_event_attendee_list | ||
| NEW ir.actions.report: event.action_report_event_event_badge | ||
| NEW ir.actions.report: event.action_report_event_registration_attendee_list | ||
| NEW ir.actions.report: event.action_report_event_registration_badge | ||
| NEW ir.actions.report: event.action_report_event_registration_responsive_html_ticket | ||
| DEL ir.actions.report: event.action_report_event_event_foldable_badge | ||
| DEL ir.actions.report: event.action_report_event_registration_foldable_badge | ||
| NEW ir.model.constraint: event.constraint_event_registration_barcode_event_uniq | ||
| NEW ir.ui.menu: event.menu_event_registration_desk | ||
| NEW ir.ui.view: event.attendee_list | ||
| NEW ir.ui.view: event.event_event_attendee_list | ||
| NEW ir.ui.view: event.event_event_report_template_badge | ||
| NEW ir.ui.view: event.event_event_view_activity | ||
| NEW ir.ui.view: event.event_registration_attendee_list | ||
| NEW ir.ui.view: event.event_registration_report_template_badge | ||
| NEW ir.ui.view: event.event_registration_report_template_responsive_html_ticket | ||
| NEW ir.ui.view: event.event_report_template_a6_badge | ||
| NEW ir.ui.view: event.event_report_template_badge_card | ||
| NEW ir.ui.view: event.event_report_template_four_per_sheet_badge | ||
| DEL ir.ui.view: event.event_event_report_template_foldable_badge | ||
| DEL ir.ui.view: event.event_registration_report_template_foldable_badge | ||
| NEW report.paperformat: event.paperformat_event_badge | ||
| DEL report.paperformat: event.paperformat_event_foldable_badge | ||
| # NOTHING TO DO | ||

Uh oh!
There was an error while loading. Please reload this page.