diff --git a/addons/mass_mailing/migrations/13.0.2.0/openupgrade_analysis_work.txt b/addons/mass_mailing/migrations/13.0.2.0/openupgrade_analysis_work.txt index cb15128beac0..ef7136c4b09f 100644 --- a/addons/mass_mailing/migrations/13.0.2.0/openupgrade_analysis_work.txt +++ b/addons/mass_mailing/migrations/13.0.2.0/openupgrade_analysis_work.txt @@ -45,6 +45,10 @@ mass_mailing / mail.mass_mailing.list_contact_rel / list_id (many2one) mass_mailing / mail.mass_mailing.list / contact_ids (many2many) : relation is now 'mailing.contact' ('mail.mass_mailing.contact') [nothing to do] # NOTHING TO DO: Renamed models, but IDs don't change +mass_mailing / mail.mass_mailing / contact_list_ids (many2many) : column1 is now 'mailing_mailing_id' ('mail_mass_mailing_id') +mass_mailing / mail.mass_mailing / contact_list_ids (many2many) : column2 is now 'mailing_list_id' ('mail_mass_mailing_list_id') +# DONE: pre-migration: renamed columns + mass_mailing / link.tracker.click / mail_stat_id (many2one) : DEL relation: mail.mail.statistics mass_mailing / link.tracker.click / mailing_trace_id (many2one) : NEW relation: mailing.trace mass_mailing / mail.mail / mailing_trace_ids (one2many) : NEW relation: mailing.trace @@ -65,6 +69,9 @@ mass_mailing / mail.mass_mailing.contact / tag_ids (many2many) : table mass_mailing / mail.mass_mailing.list / contact_ids (many2many) : table is now 'mailing_contact_list_rel' ('mail_mass_mailing_contact_list_rel') # DONE: pre-migration renamed tables +mass_mailing / mail.mass_mailing.contact / tag_ids (many2many) : column1 is now 'mailing_contact_id' ('mail_mass_mailing_contact_id') +# DONE: pre-migration: renamed column + mass_mailing / mail.mass_mailing.contact / website_message_ids (one2many): module is now 'portal' ('mass_mailing') # NOTHING TO DO: Field relocated, but field definition XML-IDs are automatically handled by core diff --git a/addons/mass_mailing/migrations/13.0.2.0/pre-migration.py b/addons/mass_mailing/migrations/13.0.2.0/pre-migration.py index 9a3ee55d3c32..e6780f8e2c17 100644 --- a/addons/mass_mailing/migrations/13.0.2.0/pre-migration.py +++ b/addons/mass_mailing/migrations/13.0.2.0/pre-migration.py @@ -1,7 +1,18 @@ # Copyright 2020 Payam Yasaie +# Copyright 2021 ForgeFlow # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openupgradelib import openupgrade +_column_renames = { + 'mail_mass_mailing_list_rel': [ + ('mail_mass_mailing_id', 'mailing_mailing_id'), + ('mail_mass_mailing_list_id', 'mailing_list_id'), + ], + 'mail_mass_mailing_contact_res_partner_category_rel': [ + ('mail_mass_mailing_contact_id', 'mailing_contact_id'), + ], +} + _model_renames = [ ('mail.mail.statistics', 'mailing.trace'), ('mail.mass_mailing', 'mailing.mailing'), @@ -63,6 +74,7 @@ @openupgrade.migrate() def migrate(env, version): + openupgrade.rename_columns(env.cr, _column_renames) openupgrade.rename_models(env.cr, _model_renames) openupgrade.rename_tables(env.cr, _table_renames) openupgrade.rename_fields(env, _field_renames)