From c832802709aba72dcf44eb60fdbc3ba45e57a608 Mon Sep 17 00:00:00 2001 From: David Vidal Date: Thu, 22 Jun 2017 13:19:47 +0200 Subject: [PATCH] [10.0] mail_tracking_mass_mailing: Migration to 10.0 --- mail_tracking_mass_mailing/README.rst | 3 ++- .../{__openerp__.py => __manifest__.py} | 3 ++- mail_tracking_mass_mailing/hooks.py | 2 +- mail_tracking_mass_mailing/models/mail_mail.py | 2 +- .../models/mail_mail_statistics.py | 2 +- .../models/mail_mass_mailing_contact.py | 2 +- .../models/mail_tracking_email.py | 2 +- .../models/mail_tracking_event.py | 2 +- .../tests/test_mass_mailing.py | 14 +++++++++----- .../views/mail_mass_mailing_view.xml | 3 ++- 10 files changed, 21 insertions(+), 14 deletions(-) rename mail_tracking_mass_mailing/{__openerp__.py => __manifest__.py} (91%) diff --git a/mail_tracking_mass_mailing/README.rst b/mail_tracking_mass_mailing/README.rst index 7c345b8dcf..a6ac98a8ff 100644 --- a/mail_tracking_mass_mailing/README.rst +++ b/mail_tracking_mass_mailing/README.rst @@ -33,7 +33,7 @@ eamils again to all the recipients, you must duplicate mass mailing. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/205/9.0 + :target: https://runbot.odoo-community.org/runbot/205/10.0 Bug Tracker @@ -58,6 +58,7 @@ Contributors * Pedro M. Baeza * Antonio Espinosa * Vicent Cubells +* David Vidal Maintainer ---------- diff --git a/mail_tracking_mass_mailing/__openerp__.py b/mail_tracking_mass_mailing/__manifest__.py similarity index 91% rename from mail_tracking_mass_mailing/__openerp__.py rename to mail_tracking_mass_mailing/__manifest__.py index 40eb055404..8a73a33bf1 100644 --- a/mail_tracking_mass_mailing/__openerp__.py +++ b/mail_tracking_mass_mailing/__manifest__.py @@ -1,12 +1,13 @@ # -*- coding: utf-8 -*- # Copyright 2016 Antonio Espinosa - # Copyright 2017 Vicent Cubells - +# Copyright 2017 David Vidal - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Mail tracking for mass mailing", "summary": "Improve mass mailing email tracking", - "version": "9.0.1.0.0", + "version": "10.0.1.0.0", "category": "Social Network", "website": "http://www.tecnativa.com", "author": "Tecnativa, " diff --git a/mail_tracking_mass_mailing/hooks.py b/mail_tracking_mass_mailing/hooks.py index 51ae006746..4fd5a95cf1 100644 --- a/mail_tracking_mass_mailing/hooks.py +++ b/mail_tracking_mass_mailing/hooks.py @@ -5,7 +5,7 @@ import logging try: - from openerp.addons.mail_tracking.hooks import column_add_with_value + from odoo.addons.mail_tracking.hooks import column_add_with_value except ImportError: column_add_with_value = False diff --git a/mail_tracking_mass_mailing/models/mail_mail.py b/mail_tracking_mass_mailing/models/mail_mail.py index 112caceba6..539947c5b4 100644 --- a/mail_tracking_mass_mailing/models/mail_mail.py +++ b/mail_tracking_mass_mailing/models/mail_mail.py @@ -3,7 +3,7 @@ # Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, api +from odoo import models, api class MailMail(models.Model): diff --git a/mail_tracking_mass_mailing/models/mail_mail_statistics.py b/mail_tracking_mass_mailing/models/mail_mail_statistics.py index 1e939fa91b..e15ec8e409 100644 --- a/mail_tracking_mass_mailing/models/mail_mail_statistics.py +++ b/mail_tracking_mass_mailing/models/mail_mail_statistics.py @@ -3,7 +3,7 @@ # Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, fields +from odoo import models, fields class MailMailStatistics(models.Model): diff --git a/mail_tracking_mass_mailing/models/mail_mass_mailing_contact.py b/mail_tracking_mass_mailing/models/mail_mass_mailing_contact.py index 79c156e873..1555347ef7 100644 --- a/mail_tracking_mass_mailing/models/mail_mass_mailing_contact.py +++ b/mail_tracking_mass_mailing/models/mail_mass_mailing_contact.py @@ -3,7 +3,7 @@ # Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, api, fields +from odoo import models, api, fields class MailMassMailingContact(models.Model): diff --git a/mail_tracking_mass_mailing/models/mail_tracking_email.py b/mail_tracking_mass_mailing/models/mail_tracking_email.py index 7570f0dd0d..ca449ecb4d 100644 --- a/mail_tracking_mass_mailing/models/mail_tracking_email.py +++ b/mail_tracking_mass_mailing/models/mail_tracking_email.py @@ -3,7 +3,7 @@ # Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, fields, api +from odoo import models, fields, api class MailTrackingEmail(models.Model): diff --git a/mail_tracking_mass_mailing/models/mail_tracking_event.py b/mail_tracking_mass_mailing/models/mail_tracking_event.py index b063c57764..36be6c4a4f 100644 --- a/mail_tracking_mass_mailing/models/mail_tracking_event.py +++ b/mail_tracking_mass_mailing/models/mail_tracking_event.py @@ -3,7 +3,7 @@ # Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import api, fields, models +from odoo import api, fields, models class MailTrackingEvent(models.Model): diff --git a/mail_tracking_mass_mailing/tests/test_mass_mailing.py b/mail_tracking_mass_mailing/tests/test_mass_mailing.py index 671aa6ee3d..aff12ff1fc 100644 --- a/mail_tracking_mass_mailing/tests/test_mass_mailing.py +++ b/mail_tracking_mass_mailing/tests/test_mass_mailing.py @@ -1,13 +1,15 @@ # -*- coding: utf-8 -*- # Copyright 2016 Antonio Espinosa - # Copyright 2017 Vicent Cubells - +# Copyright 2017 David Vidal - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import mock -from openerp.tests.common import TransactionCase +from odoo.tools import mute_logger +from odoo.tests.common import TransactionCase -mock_send_email = ('openerp.addons.base.ir.ir_mail_server.' - 'ir_mail_server.send_email') +mock_send_email = ('odoo.addons.base.ir.ir_mail_server.' + 'IrMailServer.send_email') class TestMassMailing(TransactionCase): @@ -33,9 +35,10 @@ def setUp(self, *args, **kwargs): 'reply_to_mode': 'email', }) + @mute_logger('odoo.addons.mail.models.mail_mail') def test_smtp_error(self): with mock.patch(mock_send_email) as mock_func: - mock_func.side_effect = Warning('Test error') + mock_func.side_effect = Warning('Mock test error') self.mailing.send_mail() for stat in self.mailing.statistics_ids: if stat.mail_mail_id: @@ -46,7 +49,8 @@ def test_smtp_error(self): for track in tracking: self.assertEqual('error', track.state) self.assertEqual('Warning', track.error_type) - self.assertEqual('Test error', track.error_description) + self.assertEqual('Mock test error', + track.error_description) self.assertTrue(self.contact_a.email_bounced) def test_tracking_email_link(self): diff --git a/mail_tracking_mass_mailing/views/mail_mass_mailing_view.xml b/mail_tracking_mass_mailing/views/mail_mass_mailing_view.xml index 01626f4dd9..651931e18f 100644 --- a/mail_tracking_mass_mailing/views/mail_mass_mailing_view.xml +++ b/mail_tracking_mass_mailing/views/mail_mass_mailing_view.xml @@ -1,6 +1,7 @@ @@ -21,7 +22,7 @@ + parent="mass_mailing.mass_mailing_menu_root" sequence="50"/>