From 2771b2f19a91d8dc9d556f0b271de6a05d9d9376 Mon Sep 17 00:00:00 2001 From: Augustin Cisterne-Kaas Date: Wed, 6 Aug 2014 14:58:31 +0800 Subject: [PATCH 1/2] Added migration of the notify_email field. --- .../mail/migrations/8.0.1.0/post-migration.py | 42 +++++++++++++++++++ .../mail/migrations/8.0.1.0/pre-migration.py | 33 +++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 addons/mail/migrations/8.0.1.0/post-migration.py create mode 100644 addons/mail/migrations/8.0.1.0/pre-migration.py 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..2fb0e4e43e35 --- /dev/null +++ b/addons/mail/migrations/8.0.1.0/post-migration.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +# Augustin Cisterne-Kaas +# +# 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 +from openerp import pooler + + +def move_fields(cr, pool): + execute = openupgrade.logged_query + queries = [ + """ + UPDATE res_partner + SET notify_email = 'always' + WHERE notify_email != 'none' + """ + ] + for sql in queries: + execute(cr, sql) + + +@openupgrade.migrate() +def migrate(cr, version): + pool = pooler.get_pool(cr.dbname) + move_fields(cr, pool) 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..e45f186c9c50 --- /dev/null +++ b/addons/mail/migrations/8.0.1.0/pre-migration.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved. +# Augustin Cisterne-Kaas +# +# 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'), + ], +} + + +@openupgrade.migrate() +def migrate(cr, version): + openupgrade.rename_columns(cr, column_renames) From 57af3a4d109843ff0c60b82c4dfb668c79d50aaf Mon Sep 17 00:00:00 2001 From: Augustin Cisterne-Kaas Date: Thu, 7 Aug 2014 12:50:16 +0800 Subject: [PATCH 2/2] - Added migration of mail.mail reply_to and mail_server_id to mail.message. - Computed the res.partner and res.group message_last_post. - Created the openupgrade_analysis_WORK.txt. - Set the mail module development status to done in the doc module70-80.rst. --- .../8.0.1.0/openupgrade_analysis_WORK.txt | 54 +++++++++++++++++++ .../mail/migrations/8.0.1.0/post-migration.py | 15 +++++- .../openupgrade/doc/source/modules70-80.rst | 2 +- 3 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 addons/mail/migrations/8.0.1.0/openupgrade_analysis_WORK.txt 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..3c3846d1087e --- /dev/null +++ b/addons/mail/migrations/8.0.1.0/openupgrade_analysis_WORK.txt @@ -0,0 +1,54 @@ +---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 +# Ok. Nothing to do. + + +mail / mail.group / message_last_post (datetime) : NEW +# This new value is going to be computed in the post migration script. + +mail / mail.mail / email_from (char) : DEL +mail / mail.mail / recipient_ids (many2many) : NEW relation: res.partner +# Ok. Nothing to do. + + +mail / mail.mail / mail_server_id (many2one) : DEL relation: ir.mail_server +mail / mail.message / mail_server_id (many2one) : NEW relation: ir.mail_server +# OK mail_server_id moved up in mail_message + +mail / mail.mail / reply_to (char) : DEL +mail / mail.message / reply_to (char) : NEW +# OK reply_to moved up in mail_message. + + +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 / 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') +# Ok. Nothing to do. + +mail / res.partner / message_last_post (datetime) : NEW +# This new value is going to be computed in the post migration script. + +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] +# OK: Set notify_email value to always if different from none. + +mail / res.users / display_groups_suggestions (boolean): NEW +# Ok. Nothing to do. + +---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 diff --git a/addons/mail/migrations/8.0.1.0/post-migration.py b/addons/mail/migrations/8.0.1.0/post-migration.py index 2fb0e4e43e35..f15cac2b588c 100644 --- a/addons/mail/migrations/8.0.1.0/post-migration.py +++ b/addons/mail/migrations/8.0.1.0/post-migration.py @@ -19,8 +19,8 @@ # along with this program. If not, see . # ############################################################################## -from openerp.openupgrade import openupgrade -from openerp import pooler +from openerp.openupgrade import openupgrade, openupgrade_80 +from openerp import pooler, SUPERUSER_ID def move_fields(cr, pool): @@ -40,3 +40,14 @@ def move_fields(cr, pool): def migrate(cr, version): pool = pooler.get_pool(cr.dbname) move_fields(cr, pool) + openupgrade.move_field_m2o( + cr, pool, + 'mail.mail', 'reply_to', 'mail_message_id', + 'mail.message', 'reply_to') + openupgrade.move_field_m2o( + cr, pool, + 'mail.mail', 'mail_server_id', 'mail_message_id', + 'mail.message', 'mail_server_id') + openupgrade_80.set_message_last_post( + cr, SUPERUSER_ID, pool, ['res.partner', 'mail.group'] + ) 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 | +-----------------------------------+-----------------------------------+