diff --git a/.travis.yml b/.travis.yml index c8f9fedb..f4ace9c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,6 +28,7 @@ virtualenv: system_site_packages: true install: + - pip install sendgrid - git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools - export PATH=${HOME}/maintainer-quality-tools/travis:${PATH} - travis_install_nightly diff --git a/mail_sendgrid/README.rst b/mail_sendgrid/README.rst index ba8270a1..e3a9ed92 100644 --- a/mail_sendgrid/README.rst +++ b/mail_sendgrid/README.rst @@ -75,7 +75,7 @@ From e-mails, use the "Send (SendGrid)" button to send the e-mail using Sendgrid .. 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 Known issues / Roadmap ====================== diff --git a/mail_sendgrid/__init__.py b/mail_sendgrid/__init__.py index 115c5e97..673b18f9 100644 --- a/mail_sendgrid/__init__.py +++ b/mail_sendgrid/__init__.py @@ -1,13 +1,6 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2015 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Roman Zoller -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2015-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import models from . import wizards diff --git a/mail_sendgrid/__manifest__.py b/mail_sendgrid/__manifest__.py new file mode 100644 index 00000000..a592afa9 --- /dev/null +++ b/mail_sendgrid/__manifest__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Copyright 2015-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + 'name': 'SendGrid', + 'version': '10.0.1.0.0', + 'category': 'Social Network', + 'author': 'Compassion CH, Odoo Community Association (OCA)', + 'license': 'AGPL-3', + 'website': 'http://www.compassion.ch', + 'depends': ['mail_tracking'], + 'data': [ + 'security/ir.model.access.csv', + 'views/sendgrid_email_view.xml', + 'views/sendgrid_template_view.xml', + 'views/mail_compose_message_view.xml', + 'views/email_template_view.xml', + ], + 'demo': [], + 'installable': True, + 'auto_install': False, + 'external_dependencies': { + 'python': ['sendgrid'], + }, +} diff --git a/mail_sendgrid/__openerp__.py b/mail_sendgrid/__openerp__.py deleted file mode 100644 index f406ea47..00000000 --- a/mail_sendgrid/__openerp__.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# ______ Releasing children from poverty _ -# / ____/___ ____ ___ ____ ____ ___________(_)___ ____ -# / / / __ \/ __ `__ \/ __ \/ __ `/ ___/ ___/ / __ \/ __ \ -# / /___/ /_/ / / / / / / /_/ / /_/ (__ |__ ) / /_/ / / / / -# \____/\____/_/ /_/ /_/ .___/\__,_/____/____/_/\____/_/ /_/ -# /_/ -# in Jesus' name -# -# Copyright (C) 2015-2017 Compassion CH (http://www.compassion.ch) -# @author: Emanuel Cino, Roman Zoller -# -# 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 . -# -############################################################################## - - -{ - 'name': 'SendGrid', - 'version': '9.0.1.0.0', - 'category': 'Social Network', - 'author': 'Compassion CH', - 'website': 'http://www.compassion.ch', - 'depends': ['mail_tracking'], - 'data': [ - 'security/ir.model.access.csv', - 'views/sendgrid_email_view.xml', - 'views/sendgrid_template_view.xml', - 'views/mail_compose_message_view.xml', - 'views/email_template_view.xml', - ], - 'demo': [], - 'installable': True, - 'auto_install': False, - 'external_dependencies': { - 'python': ['sendgrid'], - }, -} diff --git a/mail_sendgrid/controllers/__init__.py b/mail_sendgrid/controllers/__init__.py index f6dff205..5fcac7c2 100644 --- a/mail_sendgrid/controllers/__init__.py +++ b/mail_sendgrid/controllers/__init__.py @@ -1,13 +1,6 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import json_request from . import sendgrid_event_webhook diff --git a/mail_sendgrid/controllers/json_request.py b/mail_sendgrid/controllers/json_request.py index 05a528bd..189159ba 100644 --- a/mail_sendgrid/controllers/json_request.py +++ b/mail_sendgrid/controllers/json_request.py @@ -1,16 +1,9 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import simplejson -from openerp.http import JsonRequest, Root, Response +from odoo.http import JsonRequest, Root, Response # Monkeypatch type of request rooter to use RESTJsonRequest old_get_request = Root.get_request diff --git a/mail_sendgrid/controllers/sendgrid_event_webhook.py b/mail_sendgrid/controllers/sendgrid_event_webhook.py index 06b97479..87ee7fbf 100644 --- a/mail_sendgrid/controllers/sendgrid_event_webhook.py +++ b/mail_sendgrid/controllers/sendgrid_event_webhook.py @@ -1,17 +1,10 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import logging -from openerp import http -from openerp.addons.mail_tracking.controllers.main import \ +from odoo import http +from odoo.addons.mail_tracking.controllers.main import \ MailTrackingController, _env_get _logger = logging.getLogger(__name__) diff --git a/mail_sendgrid/models/__init__.py b/mail_sendgrid/models/__init__.py index c2e2279c..58da3aa4 100644 --- a/mail_sendgrid/models/__init__.py +++ b/mail_sendgrid/models/__init__.py @@ -1,13 +1,6 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2015 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Roman Zoller -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import mail_mail from . import substitution diff --git a/mail_sendgrid/models/email_lang_template.py b/mail_sendgrid/models/email_lang_template.py index 40d0480f..a12d032e 100644 --- a/mail_sendgrid/models/email_lang_template.py +++ b/mail_sendgrid/models/email_lang_template.py @@ -1,15 +1,8 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields +from odoo import models, fields class LanguageTemplate(models.Model): diff --git a/mail_sendgrid/models/email_template.py b/mail_sendgrid/models/email_template.py index a2799e4e..4f290c88 100644 --- a/mail_sendgrid/models/email_template.py +++ b/mail_sendgrid/models/email_template.py @@ -1,15 +1,8 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2015 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Roman Zoller -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields, api +from odoo import models, fields, api class EmailTemplate(models.Model): diff --git a/mail_sendgrid/models/email_tracking.py b/mail_sendgrid/models/email_tracking.py index a5d6b486..930f6ffd 100644 --- a/mail_sendgrid/models/email_tracking.py +++ b/mail_sendgrid/models/email_tracking.py @@ -1,19 +1,12 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016-2017 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import logging from datetime import datetime from werkzeug.useragents import UserAgent -from openerp import models, fields, api +from odoo import models, fields, api _logger = logging.getLogger(__name__) diff --git a/mail_sendgrid/models/mail_mail.py b/mail_sendgrid/models/mail_mail.py index cde19d49..52da8b68 100644 --- a/mail_sendgrid/models/mail_mail.py +++ b/mail_sendgrid/models/mail_mail.py @@ -1,16 +1,9 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2015-2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Roman Zoller, Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## -from openerp import models, fields, api, exceptions, tools, _ -from openerp.tools.config import config -from openerp.tools.safe_eval import safe_eval +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import models, fields, api, exceptions, tools, _ +from odoo.tools.config import config +from odoo.tools.safe_eval import safe_eval import base64 import logging @@ -122,8 +115,7 @@ class OdooMail(models.Model): one. """ api_key = config.get('sendgrid_api_key') if not api_key: - raise exceptions.Warning( - 'ConfigError', + raise exceptions.UserError( _('Missing sendgrid_api_key in conf file')) sg = SendGridAPIClient(apikey=api_key) @@ -195,15 +187,16 @@ class OdooMail(models.Model): subject = self.subject and self.subject.encode( "utf_8") or "(No subject)" personalization.subject = subject - addresses = list() + addresses = set() if not test_address: - if self.email_to and self.email_to not in addresses: - personalization.add_to(Email(self.email_to)) - addresses.append(self.email_to) + if self.email_to: + addresses = set(self.email_to.split(',')) + for address in addresses: + personalization.add_to(Email(address)) for recipient in self.recipient_ids: if recipient.email not in addresses: personalization.add_to(Email(recipient.email)) - addresses.append(recipient.email) + addresses.add(recipient.email) if self.email_cc and self.email_cc not in addresses: personalization.add_cc(Email(self.email_cc)) else: diff --git a/mail_sendgrid/models/mail_tracking_event.py b/mail_sendgrid/models/mail_tracking_event.py index 1f534b97..c327cc24 100644 --- a/mail_sendgrid/models/mail_tracking_event.py +++ b/mail_sendgrid/models/mail_tracking_event.py @@ -2,7 +2,7 @@ # © 2017 Emanuel Cino - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, api +from odoo import models, api class MailTrackingEvent(models.Model): diff --git a/mail_sendgrid/models/sendgrid_template.py b/mail_sendgrid/models/sendgrid_template.py index 7d4bb948..ea07f807 100644 --- a/mail_sendgrid/models/sendgrid_template.py +++ b/mail_sendgrid/models/sendgrid_template.py @@ -1,15 +1,8 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2015 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Roman Zoller -# -# The licence is in the file __openerp__.py -# -############################################################################## -from openerp import models, fields, api, exceptions, _ -from openerp.tools.config import config +# -*- coding: utf-8 -*- +# Copyright 2015-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import models, fields, api, exceptions, _ +from odoo.tools.config import config import json import re @@ -49,8 +42,7 @@ class SendgridTemplate(models.Model): def update(self): api_key = config.get('sendgrid_api_key') if not api_key: - raise exceptions.Warning( - 'ConfigError', + raise exceptions.UserError( _('Missing sendgrid_api_key in conf file')) sg = sendgrid.SendGridAPIClient(apikey=api_key) diff --git a/mail_sendgrid/models/substitution.py b/mail_sendgrid/models/substitution.py index 0390325b..7f9c9bba 100644 --- a/mail_sendgrid/models/substitution.py +++ b/mail_sendgrid/models/substitution.py @@ -1,15 +1,8 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2015 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Roman Zoller, Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2015-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields +from odoo import models, fields class Substitution(models.Model): diff --git a/mail_sendgrid/tests/__init__.py b/mail_sendgrid/tests/__init__.py index be6907c4..7853a92b 100644 --- a/mail_sendgrid/tests/__init__.py +++ b/mail_sendgrid/tests/__init__.py @@ -1,12 +1,5 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2017 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2015-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import test_mail_sendgrid diff --git a/mail_sendgrid/tests/test_mail_sendgrid.py b/mail_sendgrid/tests/test_mail_sendgrid.py index 698fbe22..eea251d9 100644 --- a/mail_sendgrid/tests/test_mail_sendgrid.py +++ b/mail_sendgrid/tests/test_mail_sendgrid.py @@ -2,7 +2,7 @@ # © 2017 Emanuel Cino - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import mock -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase mock_base_send = 'openerp.addons.mail.models.mail_mail.MailMail.send' mock_sendgrid_api_client = ('openerp.addons.mail_sendgrid.models.mail_mail' @@ -75,7 +75,7 @@ class TestMailSendgrid(TransactionCase): self.request = FakeRequest(self.event) def create_email(self, vals=None): - mail_vals = self.mail_wizard.render_message(self.recipient.ids)[ + mail_vals = self.mail_wizard.get_mail_values(self.recipient.ids)[ self.recipient.id] mail_vals['recipient_ids'] = [(6, 0, self.recipient.ids)] if vals is not None: @@ -93,7 +93,7 @@ class TestMailSendgrid(TransactionCase): def test_create_email(self): """ Test that Sendgrid template is pushed in e-mail. """ self.mail_template.update_substitutions() - mail_values = self.mail_wizard.render_message(self.recipient.ids)[ + mail_values = self.mail_wizard.get_mail_values(self.recipient.ids)[ self.recipient.id] # Test Sendgrid HTML preview self.assertEqual( diff --git a/mail_sendgrid/views/sendgrid_template_view.xml b/mail_sendgrid/views/sendgrid_template_view.xml index ef20f88e..23000005 100644 --- a/mail_sendgrid/views/sendgrid_template_view.xml +++ b/mail_sendgrid/views/sendgrid_template_view.xml @@ -49,13 +49,11 @@ Update Sendgrid Templates - -self.update(cr, uid, context=context) + object.update() action = { 'name': 'Sendgrid templates', 'type': 'ir.actions.act_window', 'res_model': 'sendgrid.template', - 'view_type': 'form', 'view_mode': 'tree,form' } diff --git a/mail_sendgrid/wizards/__init__.py b/mail_sendgrid/wizards/__init__.py index 8494af16..476a596f 100644 --- a/mail_sendgrid/wizards/__init__.py +++ b/mail_sendgrid/wizards/__init__.py @@ -1,13 +1,6 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2015-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import mail_compose_message from . import email_template_preview diff --git a/mail_sendgrid/wizards/email_template_preview.py b/mail_sendgrid/wizards/email_template_preview.py index 77e20fb4..95759be2 100644 --- a/mail_sendgrid/wizards/email_template_preview.py +++ b/mail_sendgrid/wizards/email_template_preview.py @@ -1,15 +1,8 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2015-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, api +from odoo import models, api class EmailTemplatePreview(models.TransientModel): diff --git a/mail_sendgrid/wizards/mail_compose_message.py b/mail_sendgrid/wizards/mail_compose_message.py index 369081d8..f2932c90 100644 --- a/mail_sendgrid/wizards/mail_compose_message.py +++ b/mail_sendgrid/wizards/mail_compose_message.py @@ -1,15 +1,8 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## - -from openerp import models, fields, api +# -*- coding: utf-8 -*- +# Copyright 2015-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models, fields, api class EmailComposeMessage(models.TransientModel): diff --git a/mail_sendgrid_mass_mailing/__init__.py b/mail_sendgrid_mass_mailing/__init__.py index 1c9429f1..211f3a48 100644 --- a/mail_sendgrid_mass_mailing/__init__.py +++ b/mail_sendgrid_mass_mailing/__init__.py @@ -1,13 +1,6 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import models from . import wizards diff --git a/mail_sendgrid_mass_mailing/__manifest__.py b/mail_sendgrid_mass_mailing/__manifest__.py new file mode 100644 index 00000000..cbda3a80 --- /dev/null +++ b/mail_sendgrid_mass_mailing/__manifest__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + 'name': 'Mass Mailing with SendGrid', + 'version': '10.0.1.0.0', + 'category': 'Social Network', + 'author': 'Compassion CH, Odoo Community Association (OCA)', + 'license': 'AGPL-3', + 'website': 'http://www.compassion.ch', + 'depends': ['mail_sendgrid', 'mail_tracking_mass_mailing'], + 'data': [ + 'views/mass_mailing_view.xml' + ], + 'demo': [], + 'installable': True, + 'auto_install': True, + 'external_dependencies': { + 'python': ['sendgrid'], + }, +} diff --git a/mail_sendgrid_mass_mailing/__openerp__.py b/mail_sendgrid_mass_mailing/__openerp__.py deleted file mode 100644 index acc4e3cd..00000000 --- a/mail_sendgrid_mass_mailing/__openerp__.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# ______ Releasing children from poverty _ -# / ____/___ ____ ___ ____ ____ ___________(_)___ ____ -# / / / __ \/ __ `__ \/ __ \/ __ `/ ___/ ___/ / __ \/ __ \ -# / /___/ /_/ / / / / / / /_/ / /_/ (__ |__ ) / /_/ / / / / -# \____/\____/_/ /_/ /_/ .___/\__,_/____/____/_/\____/_/ /_/ -# /_/ -# in Jesus' name -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# @author: Emanuel Cino -# -# 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 . -# -############################################################################## - - -{ - 'name': 'Mass Mailing with SendGrid', - 'version': '9.0.1.0.0', - 'category': 'Social Network', - 'author': 'Compassion CH', - 'website': 'http://www.compassion.ch', - 'depends': ['mail_sendgrid', 'mail_tracking_mass_mailing'], - 'data': [ - 'views/mass_mailing_view.xml' - ], - 'demo': [], - 'installable': True, - 'auto_install': True, - 'external_dependencies': { - 'python': ['sendgrid'], - }, -} diff --git a/mail_sendgrid_mass_mailing/models/__init__.py b/mail_sendgrid_mass_mailing/models/__init__.py index a0d4e22a..1cfb554a 100644 --- a/mail_sendgrid_mass_mailing/models/__init__.py +++ b/mail_sendgrid_mass_mailing/models/__init__.py @@ -1,13 +1,6 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import mass_mailing from . import mail_mail diff --git a/mail_sendgrid_mass_mailing/models/email_tracking.py b/mail_sendgrid_mass_mailing/models/email_tracking.py index 21c236f9..d17cad35 100644 --- a/mail_sendgrid_mass_mailing/models/email_tracking.py +++ b/mail_sendgrid_mass_mailing/models/email_tracking.py @@ -1,14 +1,7 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## -from openerp import models, fields, api +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import models, fields, api class MailTrackingEvent(models.Model): diff --git a/mail_sendgrid_mass_mailing/models/mail_mail.py b/mail_sendgrid_mass_mailing/models/mail_mail.py index c148df29..d75a1547 100644 --- a/mail_sendgrid_mass_mailing/models/mail_mail.py +++ b/mail_sendgrid_mass_mailing/models/mail_mail.py @@ -1,14 +1,7 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## -from openerp import models +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import models import logging _logger = logging.getLogger(__name__) diff --git a/mail_sendgrid_mass_mailing/models/mass_mailing.py b/mail_sendgrid_mass_mailing/models/mass_mailing.py index e8df45b1..63f389ce 100644 --- a/mail_sendgrid_mass_mailing/models/mass_mailing.py +++ b/mail_sendgrid_mass_mailing/models/mass_mailing.py @@ -1,17 +1,10 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import api, models, fields, _ -from openerp.exceptions import Warning as UserError -from openerp.tools.safe_eval import safe_eval +from odoo import api, models, fields, _ +from odoo.exceptions import Warning as UserError +from odoo.tools.safe_eval import safe_eval class MassMailing(models.Model): @@ -98,7 +91,7 @@ class MassMailing(models.Model): self.ensure_one() if self.email_template_id: # use E-mail Template - res_ids = self.get_recipients(self) + res_ids = self.get_recipients() if not res_ids: raise UserError(_('Please select recipients.')) template = self.email_template_id diff --git a/mail_sendgrid_mass_mailing/tests/__init__.py b/mail_sendgrid_mass_mailing/tests/__init__.py index d1f8406a..b5c1ba78 100644 --- a/mail_sendgrid_mass_mailing/tests/__init__.py +++ b/mail_sendgrid_mass_mailing/tests/__init__.py @@ -1,12 +1,5 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2017 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import test_mass_mailing diff --git a/mail_sendgrid_mass_mailing/tests/test_mass_mailing.py b/mail_sendgrid_mass_mailing/tests/test_mass_mailing.py index e96b878c..2a217cc4 100644 --- a/mail_sendgrid_mass_mailing/tests/test_mass_mailing.py +++ b/mail_sendgrid_mass_mailing/tests/test_mass_mailing.py @@ -2,7 +2,7 @@ # © 2017 Emanuel Cino - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import mock -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase mock_sendgrid_api_client = ('openerp.addons.mail_sendgrid.models.mail_mail' '.SendGridAPIClient') diff --git a/mail_sendgrid_mass_mailing/views/mass_mailing_view.xml b/mail_sendgrid_mass_mailing/views/mass_mailing_view.xml index 5c42f523..e20a2d0f 100644 --- a/mail_sendgrid_mass_mailing/views/mass_mailing_view.xml +++ b/mail_sendgrid_mass_mailing/views/mass_mailing_view.xml @@ -1,31 +1,28 @@ - - - - - mass.mailing.sendgrid.form - mail.mass_mailing - - - - - - - - - - - - - - - - - - - - - - - - + + + + mass.mailing.sendgrid.form + mail.mass_mailing + + + + + + + + + + + + + + + + + + + + + + diff --git a/mail_sendgrid_mass_mailing/wizards/__init__.py b/mail_sendgrid_mass_mailing/wizards/__init__.py index feb13ba4..133c9590 100644 --- a/mail_sendgrid_mass_mailing/wizards/__init__.py +++ b/mail_sendgrid_mass_mailing/wizards/__init__.py @@ -1,13 +1,6 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import mail_compose_message from . import test_mailing diff --git a/mail_sendgrid_mass_mailing/wizards/mail_compose_message.py b/mail_sendgrid_mass_mailing/wizards/mail_compose_message.py index 46a9ada7..47a80f64 100644 --- a/mail_sendgrid_mass_mailing/wizards/mail_compose_message.py +++ b/mail_sendgrid_mass_mailing/wizards/mail_compose_message.py @@ -1,15 +1,8 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, api +from odoo import models, api class EmailComposeMessage(models.TransientModel): diff --git a/mail_sendgrid_mass_mailing/wizards/test_mailing.py b/mail_sendgrid_mass_mailing/wizards/test_mailing.py index ae4e862f..ccb8f175 100644 --- a/mail_sendgrid_mass_mailing/wizards/test_mailing.py +++ b/mail_sendgrid_mass_mailing/wizards/test_mailing.py @@ -1,15 +1,8 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2016 Compassion CH (http://www.compassion.ch) -# Releasing children from poverty in Jesus' name -# @author: Emanuel Cino -# -# The licence is in the file __openerp__.py -# -############################################################################## +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Compassion CH (http://www.compassion.ch) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, api, tools +from odoo import models, api, tools class TestMassMailing(models.TransientModel):