Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions addons/mail/migrations/8.0.1.0/openupgrade_analysis_work.txt
Original file line number Diff line number Diff line change
@@ -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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the new alias_parent* fields enable a button 'open_parent_document' from the alias view. This allows quick navigation from a task alias to the associated project. I guess the values for these fields will have to be filled in their respective modules. It looks like the create method of the models show us with which values to fill them. I find these fields in

crm/res_config.py
crm/sales_team.py
hr_recruitment/hr_recruitment.py
hr_recruitment/res_config.py
mail/mail_group.py
mail/res_users.py
project/project.py

See the project migration that I now adapted: 0ab9e69

You should do similarly for the mail.group and res.users model, because their aliases are created in this module.

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
50 changes: 50 additions & 0 deletions addons/mail/migrations/8.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################

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'])
52 changes: 52 additions & 0 deletions addons/mail/migrations/8.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2010 - 2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################

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)
2 changes: 1 addition & 1 deletion openerp/openupgrade/doc/source/modules70-80.rst
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ Status :
+-----------------------------------+-----------------------------------+
|lunch | Nothing to do |
+-----------------------------------+-----------------------------------+
|mail | |
|mail | Done |
+-----------------------------------+-----------------------------------+
|marketing | Nothing to do |
+-----------------------------------+-----------------------------------+
Expand Down