Skip to content
Merged
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
6 changes: 6 additions & 0 deletions addons/mail/migrations/10.0.1.0/noupdate_changes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<record id="mail_followers_read_write_own" model="ir.rule">
<field name="groups" eval="[(4, ref('base.group_user')), (4, ref('base.group_portal'))]"/>
</record>
</odoo>
6 changes: 3 additions & 3 deletions addons/mail/migrations/10.0.1.0/openupgrade_analysis_work.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ mail / mail.notification / email_status (selection) : NEW se
mail / mail.notification / is_email (boolean) : NEW
mail / mail.notification / is_read (boolean) : NEW
mail / mail.notification / res_partner_id (many2one) : NEW relation: res.partner, required: required
# TODO: Migrate from table table mail_message_res_partner_needaction_rel
# set email_status, is_email, is_read in post migration

mail / mail.shortcode / substitution (char) : type is now 'text' ('char')
# TODO: pre-migration. copy column
# TODO: post-migration. Move from old column converting to text
# NOTHING TO DO

mail / mail.template / scheduled_date (char) : NEW
# NOTHING TO DO
Expand All @@ -39,6 +38,7 @@ DEL ir.actions.act_window.view: mail.action_contacts_view_form
DEL ir.actions.act_window.view: mail.action_contacts_view_kanban
DEL ir.actions.act_window.view: mail.action_contacts_view_tree
NEW ir.config_parameter: mail.icp_mail_bounce_alias
# create an xmlid if this one already exists
NEW ir.model.access: mail.access_mail_notification_portal
NEW ir.model.access: mail.access_mail_notification_system
NEW ir.model.access: mail.access_mail_notification_user
Expand Down
30 changes: 30 additions & 0 deletions addons/mail/migrations/10.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# © 2017 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade


@openupgrade.migrate(use_env=False)
def migrate(cr, version):
# the table exists already, so the ORM doesn't create an id column
cr.execute(
'alter table mail_message_res_partner_needaction_rel '
'add column id serial not null primary key'
)
# as 9.0 deleted notifications for read messages, all existing
# notifications are unread by definition
cr.execute(
'update mail_message_res_partner_needaction_rel set is_read=False'
)
# set email properties
cr.execute(
"""update mail_message_res_partner_needaction_rel rel
set is_email=True, email_status=case
when m.state in ('sent', 'exception') then m.state
else 'ready'
end
from mail_mail m
where rel.mail_message_id=m.mail_message_id"""
)
openupgrade.load_data(
cr, 'mail', 'migrations/10.0.1.0/noupdate_changes.xml')
16 changes: 16 additions & 0 deletions addons/mail/migrations/10.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# © 2017 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade


@openupgrade.migrate(use_env=False)
def migrate(cr, version):
# create an xmlid for mail.bounce.alias is it exists
cr.execute(
"""insert into ir_model_data
(module, name, model, res_id)
select 'mail', 'icp_mail_bounce_alias', 'ir.config_parameter', id
from ir_config_parameter
where key='mail.bounce.alias' limit 1"""
)
14 changes: 14 additions & 0 deletions addons/mail/migrations/10.0.1.0/tests/test_data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-
Test data to test email notifications
-
!record {model: mail.mail, id: mail.test_mail_outgoing}:
state: 'outgoing'
-
!record {model: mail.mail, id: mail.test_mail_outgoing}:
needaction_partner_ids: [base.res_partner_1]
-
!record {model: mail.mail, id: mail.test_mail_exception}:
state: 'exception'
-
!record {model: mail.mail, id: mail.test_mail_exception}:
needaction_partner_ids: [base.res_partner_1]
25 changes: 25 additions & 0 deletions addons/mail/migrations/10.0.1.0/tests/test_mail.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# © 2017 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests.common import TransactionCase


class TestMail(TransactionCase):
def test_mail(self):
# check that our test mails have the correct states
notification = self.env['mail.notification'].search([
(
'mail_message_id', '=',
self.env.ref('mail.test_mail_outgoing').mail_message_id.id
),
])
self.assertTrue(notification.is_email)
self.assertEqual(notification.email_status, 'ready')
notification = self.env['mail.notification'].search([
(
'mail_message_id', '=',
self.env.ref('mail.test_mail_exception').mail_message_id.id
),
])
self.assertTrue(notification.is_email)
self.assertEqual(notification.email_status, 'exception')
4 changes: 2 additions & 2 deletions odoo/openupgrade/doc/source/modules90-100.rst
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ Status :
+-----------------------------------+-----------------------------------+
|lunch | |
+-----------------------------------+-----------------------------------+
|mail | |
|mail | Done |
+-----------------------------------+-----------------------------------+
|mail_tip | |
+-----------------------------------+-----------------------------------+
Expand Down Expand Up @@ -453,7 +453,7 @@ Status :
+-----------------------------------+-----------------------------------+
|warning | |
+-----------------------------------+-----------------------------------+
|web | |
|web | Nothing to do |
+-----------------------------------+-----------------------------------+
|web_analytics | |
+-----------------------------------+-----------------------------------+
Expand Down