diff --git a/addons/mail/migrations/8.0.1.0/openupgrade_analysis_work.txt b/addons/mail/migrations/8.0.1.0/openupgrade_analysis_work.txt new file mode 100644 index 000000000000..31c6a98f3623 --- /dev/null +++ b/addons/mail/migrations/8.0.1.0/openupgrade_analysis_work.txt @@ -0,0 +1,46 @@ +---Fields in module 'mail'--- +mail / mail.alias / alias_contact (selection) : NEW required: required, selection_keys: ['everyone', 'followers', 'partners'], req_default: everyone +mail / mail.alias / alias_parent_model_id (many2one): NEW relation: ir.model +mail / mail.alias / alias_parent_thread_id (integer): NEW +mail / mail.mail / recipient_ids (many2many) : NEW relation: res.partner +mail / mail.message / record_name (char) : not a function anymore +mail / mail.message.subtype / hidden (boolean) : NEW +mail / mail.message.subtype / sequence (integer) : NEW +mail / res.users / display_groups_suggestions (boolean): NEW +## Nothing to do + +mail / mail.thread / message_follower_ids (many2many): module is now 'website_mail' ('mail') +mail / mail.thread / message_ids (one2many) : module is now 'website_mail' ('mail') +mail / mail.thread / message_is_follower (boolean) : module is now 'website_mail' ('mail') +mail / mail.thread / message_summary (text) : module is now 'website_mail' ('mail') +mail / mail.thread / message_unread (boolean) : module is now 'website_mail' ('mail') +# TODO Added after initial analysis + +mail / mail.group / message_last_post (datetime) : NEW +mail / res.partner / message_last_post (datetime) : NEW +## TODO something with last_post in openupgrade80 + +mail / res.partner / notification_email_send (selection): selection_keys is now '['always', 'none']' ('['all', 'comment', 'email', 'none']') +mail / res.partner / notification_email_send (selection): was renamed to notify_email [nothing to to] +## all, comment, email -> always, none -> none + +mail / mail.mail / email_from (char) : DEL +## Possibly moved to mail.message, nothing done + +mail / mail.mail / mail_server_id (many2one) : DEL relation: ir.mail_server +mail / mail.mail / reply_to (char) : DEL +mail / mail.message / mail_server_id (many2one) : NEW relation: ir.mail_server +mail / mail.message / reply_to (char) : NEW +## Moved from mail.mail to mail.message + +---XML records in module 'mail'--- +NEW ir.actions.act_window: base.action_attachment +NEW ir.actions.client: mail.action_client_messaging_menu +NEW ir.actions.server: mail.action_mail_redirect +NEW ir.actions.todo: base.open_menu +NEW ir.config_parameter: mail.icp_mail_catchall_alias +NEW ir.rule: mail.mail_followers_read_write_others +NEW ir.ui.view: mail.assets_backend +NEW ir.ui.view: mail.view_document_file_kanban +NEW res.partner: base.partner_root +## Nothing to do diff --git a/addons/mail/migrations/8.0.1.0/post-migration.py b/addons/mail/migrations/8.0.1.0/post-migration.py new file mode 100644 index 000000000000..62079617db1e --- /dev/null +++ b/addons/mail/migrations/8.0.1.0/post-migration.py @@ -0,0 +1,50 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2010 - 2014 Savoir-faire Linux +# (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import pooler, SUPERUSER_ID +from openerp.openupgrade import openupgrade, openupgrade_80 + + +def mail_mail_to_mail_message_migration(cr, uid, pool): + """ + The following fields have been moved from mail.mail to mail.message + * mail_server_id + * reply_to + Get the mail.message from the mail.mail object and transfer the data that + way. + """ + legacy_server_id = openupgrade.get_legacy_name('mail_server_id') + legacy_reply_to = openupgrade.get_legacy_name('reply_to') + openupgrade.logged_query(cr, """ +UPDATE mail_message +SET %s = %s, %s = %s +FROM mail_message AS a JOIN mail_mail AS b ON a.id = b.mail_message_id +""" % ('mail_server_id', legacy_server_id, 'reply_to', legacy_reply_to, )) + + +@openupgrade.migrate() +def migrate(cr, version): + pool = pooler.get_pool(cr.dbname) + uid = SUPERUSER_ID + mail_mail_to_mail_message_migration(cr, uid, pool) + openupgrade_80.set_message_last_post( + cr, uid, pool, ['mail.group', 'res.partner']) diff --git a/addons/mail/migrations/8.0.1.0/pre-migration.py b/addons/mail/migrations/8.0.1.0/pre-migration.py new file mode 100644 index 000000000000..ac8b2a53932b --- /dev/null +++ b/addons/mail/migrations/8.0.1.0/pre-migration.py @@ -0,0 +1,52 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2010 - 2014 Savoir-faire Linux +# (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.openupgrade import openupgrade + + +column_renames = { + 'res_partner': [ + ('notification_email_send', 'notify_email'), + + ], + 'mail_mail': [ + ('email_from', None), + # The following fields are to be moved to mail_message in post + ('mail_server_id', None), + ('reply_to', None), + ] +} + + +def partner_notify_migration(cr): + """The selection values 'all', 'comment' and 'email' got replaced by + 'always', 'never' is still 'never'""" + openupgrade.logged_query(cr, """ +UPDATE res_partner +SET notify_email = 'always' +WHERE notify_email IN ('all', 'comment', 'email')""") + + +@openupgrade.migrate() +def migrate(cr, version): + openupgrade.rename_columns(cr, column_renames) + partner_notify_migration(cr) diff --git a/openerp/openupgrade/doc/source/modules70-80.rst b/openerp/openupgrade/doc/source/modules70-80.rst index 5643b373a49a..3686948537f2 100644 --- a/openerp/openupgrade/doc/source/modules70-80.rst +++ b/openerp/openupgrade/doc/source/modules70-80.rst @@ -286,7 +286,7 @@ Status : +-----------------------------------+-----------------------------------+ |lunch | Nothing to do | +-----------------------------------+-----------------------------------+ -|mail | | +|mail | Done | +-----------------------------------+-----------------------------------+ |marketing | Nothing to do | +-----------------------------------+-----------------------------------+