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
54 changes: 54 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,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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The email_from field in 7.0 existed in both mail.mail and mail.message. In both case it was a char.
The visible email_from in the Odoo 8.0 mail.mail form is the one inherited from mail.message.
I believe that we should just drop it.

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.

You can add this explanation on the file itself for anyone reading it to understand that there's nothing to do.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The old function was a stored char.

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.

OK. Nothing to do also.

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.

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.

This is needed to check if in the standard process, columns are removed in mail module update and added again updating website_mail module.


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
53 changes: 53 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,53 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved.
# Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.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, openupgrade_80
from openerp import pooler, SUPERUSER_ID


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)
openupgrade.move_field_m2o(

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.

If you do this in post-migration, I think the column gets lost in standard update process. If it so (please check it), you will have to rename column to None on pre-migration, and do this operation calling to openupgrade_get_legacy_name (approximated name of the function, I don't remember exactly) for getting the new column name.

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']
)
33 changes: 33 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,33 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved.
# Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.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'),
],
}


@openupgrade.migrate()
def migrate(cr, version):
openupgrade.rename_columns(cr, column_renames)
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