-
-
Notifications
You must be signed in to change notification settings - Fork 821
Added migration of the notify_email field. #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| 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 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The old function was a stored char.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 / 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 | ||
| 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( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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'] | ||
| ) | ||
| 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.