From f65fe965652d9294ed8349bdcbf4da807a80ead7 Mon Sep 17 00:00:00 2001 From: cubells Date: Tue, 3 Jan 2017 22:57:57 +0100 Subject: [PATCH] mail_tracking_mass_mailing module --- mail_tracking_mass_mailing/README.rst | 12 +++---- mail_tracking_mass_mailing/__init__.py | 3 +- mail_tracking_mass_mailing/__openerp__.py | 5 +-- mail_tracking_mass_mailing/hooks.py | 3 +- mail_tracking_mass_mailing/i18n/ca.po | 17 ---------- mail_tracking_mass_mailing/i18n/de.po | 17 ---------- mail_tracking_mass_mailing/i18n/el_GR.po | 17 ---------- mail_tracking_mass_mailing/i18n/es.po | 18 ---------- mail_tracking_mass_mailing/i18n/es_CO.po | 17 ---------- mail_tracking_mass_mailing/i18n/fr.po | 17 ---------- mail_tracking_mass_mailing/i18n/hr.po | 17 ---------- mail_tracking_mass_mailing/i18n/it.po | 17 ---------- mail_tracking_mass_mailing/i18n/pt.po | 17 ---------- mail_tracking_mass_mailing/i18n/pt_BR.po | 17 ---------- mail_tracking_mass_mailing/i18n/sl.po | 19 ----------- mail_tracking_mass_mailing/i18n/tr.po | 17 ---------- mail_tracking_mass_mailing/models/__init__.py | 4 +-- .../models/mail_mail.py | 15 +++++---- .../models/mail_mail_statistics.py | 3 +- .../models/mail_mass_mailing.py | 31 ----------------- .../models/mail_mass_mailing_contact.py | 3 +- .../models/mail_tracking_email.py | 3 +- .../models/mail_tracking_event.py | 3 +- mail_tracking_mass_mailing/tests/__init__.py | 3 +- .../tests/test_mass_mailing.py | 33 ++++--------------- .../views/mail_mail_statistics_view.xml | 9 +++-- .../views/mail_mass_mailing_contact_view.xml | 9 +++-- .../views/mail_mass_mailing_view.xml | 20 +++-------- .../views/mail_tracking_email_view.xml | 9 +++-- 29 files changed, 55 insertions(+), 320 deletions(-) delete mode 100644 mail_tracking_mass_mailing/models/mail_mass_mailing.py diff --git a/mail_tracking_mass_mailing/README.rst b/mail_tracking_mass_mailing/README.rst index 9b8bc85e..7c345b8d 100644 --- a/mail_tracking_mass_mailing/README.rst +++ b/mail_tracking_mass_mailing/README.rst @@ -27,16 +27,13 @@ From mail statistic object, you can see: From mass mailing contact, you can see: - Email score, in order to clean up your lists from bad score emails -As a bonus feature, you have a new checkbox 'Avoid resend' in mass mailing, -in order to not send twice the same email to the same recipient. This is very -useful when you want to resend the mass mailing after changing selection -recipients. Notice that recipient selection could be a domain over a model, so -result ids could change over the time. With this flag you can send -the same email several times but only once to each recipient. +Mass mailing emails are sent only to recipients once. If you want to send +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/8.0 + :target: https://runbot.odoo-community.org/runbot/205/9.0 Bug Tracker @@ -60,6 +57,7 @@ Contributors * Pedro M. Baeza * Antonio Espinosa +* Vicent Cubells Maintainer ---------- diff --git a/mail_tracking_mass_mailing/__init__.py b/mail_tracking_mass_mailing/__init__.py index ba08c9ff..24202da2 100644 --- a/mail_tracking_mass_mailing/__init__.py +++ b/mail_tracking_mass_mailing/__init__.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# © 2016 Antonio Espinosa - +# Copyright 2016 Antonio Espinosa - +# Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/mail_tracking_mass_mailing/__openerp__.py b/mail_tracking_mass_mailing/__openerp__.py index 0f01f6e0..40eb0554 100644 --- a/mail_tracking_mass_mailing/__openerp__.py +++ b/mail_tracking_mass_mailing/__openerp__.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- -# © 2016 Antonio Espinosa - +# Copyright 2016 Antonio Espinosa - +# Copyright 2017 Vicent Cubells - # 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": "8.0.1.0.1", + "version": "9.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 b3601a29..51ae0067 100644 --- a/mail_tracking_mass_mailing/hooks.py +++ b/mail_tracking_mass_mailing/hooks.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# © 2016 Antonio Espinosa - +# Copyright 2016 Antonio Espinosa - +# Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import logging diff --git a/mail_tracking_mass_mailing/i18n/ca.po b/mail_tracking_mass_mailing/i18n/ca.po index 272e10b1..4f101ea5 100644 --- a/mail_tracking_mass_mailing/i18n/ca.po +++ b/mail_tracking_mass_mailing/i18n/ca.po @@ -32,16 +32,6 @@ msgid "" " * The 'Soft bounced' status indicates that message was soft bounced by recipient Mail Exchange (MX) server.\n" msgstr "" -#. module: mail_tracking_mass_mailing -#: field:mail.mass_mailing,avoid_resend:0 -msgid "Avoid resend" -msgstr "" - -#. module: mail_tracking_mass_mailing -#: help:mail.mass_mailing,avoid_resend:0 -msgid "Avoid to send this mass mailing email twice to the same recipient" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form msgid "Country" @@ -112,13 +102,6 @@ msgstr "Correus sortints" msgid "State" msgstr "" -#. module: mail_tracking_mass_mailing -#: code:addons/mail_tracking_mass_mailing/models/mail_mass_mailing.py:28 -#, python-format -msgid "" -"There is no more recipients to send and 'Avoid resend' option is enabled" -msgstr "" - #. module: mail_tracking_mass_mailing #: field:mail.mass_mailing.contact,tracking_email_ids:0 msgid "Tracking emails" diff --git a/mail_tracking_mass_mailing/i18n/de.po b/mail_tracking_mass_mailing/i18n/de.po index 50f47410..ead10f15 100644 --- a/mail_tracking_mass_mailing/i18n/de.po +++ b/mail_tracking_mass_mailing/i18n/de.po @@ -19,16 +19,6 @@ msgstr "" "Language: de\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. module: mail_tracking_mass_mailing -#: field:mail.mass_mailing,avoid_resend:0 -msgid "Avoid resend" -msgstr "" - -#. module: mail_tracking_mass_mailing -#: help:mail.mass_mailing,avoid_resend:0 -msgid "Avoid to send this mass mailing email twice to the same recipient" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form msgid "Country" @@ -122,13 +112,6 @@ msgstr "" msgid "Outgoing Mails" msgstr "Ausgehende Nachrichten" -#. module: mail_tracking_mass_mailing -#: code:addons/mail_tracking_mass_mailing/models/mail_mass_mailing.py:28 -#, python-format -msgid "" -"There is no more recipients to send and 'Avoid resend' option is enabled" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form #: field:mail.mail.statistics,tracking_event_ids:0 diff --git a/mail_tracking_mass_mailing/i18n/el_GR.po b/mail_tracking_mass_mailing/i18n/el_GR.po index 1d1187c6..3a8a4fec 100644 --- a/mail_tracking_mass_mailing/i18n/el_GR.po +++ b/mail_tracking_mass_mailing/i18n/el_GR.po @@ -18,16 +18,6 @@ msgstr "" "Language: el_GR\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. module: mail_tracking_mass_mailing -#: field:mail.mass_mailing,avoid_resend:0 -msgid "Avoid resend" -msgstr "" - -#. module: mail_tracking_mass_mailing -#: help:mail.mass_mailing,avoid_resend:0 -msgid "Avoid to send this mass mailing email twice to the same recipient" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form msgid "Country" @@ -121,13 +111,6 @@ msgstr "" msgid "Outgoing Mails" msgstr "" -#. module: mail_tracking_mass_mailing -#: code:addons/mail_tracking_mass_mailing/models/mail_mass_mailing.py:28 -#, python-format -msgid "" -"There is no more recipients to send and 'Avoid resend' option is enabled" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form #: field:mail.mail.statistics,tracking_event_ids:0 diff --git a/mail_tracking_mass_mailing/i18n/es.po b/mail_tracking_mass_mailing/i18n/es.po index 976aef7c..60b88db5 100644 --- a/mail_tracking_mass_mailing/i18n/es.po +++ b/mail_tracking_mass_mailing/i18n/es.po @@ -19,17 +19,6 @@ msgstr "" "Language: es\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. module: mail_tracking_mass_mailing -#: field:mail.mass_mailing,avoid_resend:0 -msgid "Avoid resend" -msgstr "Evitar reenvios" - -#. module: mail_tracking_mass_mailing -#: help:mail.mass_mailing,avoid_resend:0 -msgid "Avoid to send this mass mailing email twice to the same recipient" -msgstr "" -"Evitar que se envíe este correo masivo dos veces al mismo destinatario" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form msgid "Country" @@ -123,13 +112,6 @@ msgstr "Envío masivo" msgid "Outgoing Mails" msgstr "Correos salientes" -#. module: mail_tracking_mass_mailing -#: code:addons/mail_tracking_mass_mailing/models/mail_mass_mailing.py:28 -#, python-format -msgid "" -"There is no more recipients to send and 'Avoid resend' option is enabled" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form #: field:mail.mail.statistics,tracking_event_ids:0 diff --git a/mail_tracking_mass_mailing/i18n/es_CO.po b/mail_tracking_mass_mailing/i18n/es_CO.po index 362d5200..beb6a048 100644 --- a/mail_tracking_mass_mailing/i18n/es_CO.po +++ b/mail_tracking_mass_mailing/i18n/es_CO.po @@ -32,16 +32,6 @@ msgid "" " * The 'Soft bounced' status indicates that message was soft bounced by recipient Mail Exchange (MX) server.\n" msgstr "" -#. module: mail_tracking_mass_mailing -#: field:mail.mass_mailing,avoid_resend:0 -msgid "Avoid resend" -msgstr "" - -#. module: mail_tracking_mass_mailing -#: help:mail.mass_mailing,avoid_resend:0 -msgid "Avoid to send this mass mailing email twice to the same recipient" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form msgid "Country" @@ -112,13 +102,6 @@ msgstr "Correos Salientes" msgid "State" msgstr "" -#. module: mail_tracking_mass_mailing -#: code:addons/mail_tracking_mass_mailing/models/mail_mass_mailing.py:28 -#, python-format -msgid "" -"There is no more recipients to send and 'Avoid resend' option is enabled" -msgstr "" - #. module: mail_tracking_mass_mailing #: field:mail.mass_mailing.contact,tracking_email_ids:0 msgid "Tracking emails" diff --git a/mail_tracking_mass_mailing/i18n/fr.po b/mail_tracking_mass_mailing/i18n/fr.po index 184a5238..83a24c38 100644 --- a/mail_tracking_mass_mailing/i18n/fr.po +++ b/mail_tracking_mass_mailing/i18n/fr.po @@ -18,16 +18,6 @@ msgstr "" "Language: fr\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#. module: mail_tracking_mass_mailing -#: field:mail.mass_mailing,avoid_resend:0 -msgid "Avoid resend" -msgstr "" - -#. module: mail_tracking_mass_mailing -#: help:mail.mass_mailing,avoid_resend:0 -msgid "Avoid to send this mass mailing email twice to the same recipient" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form msgid "Country" @@ -121,13 +111,6 @@ msgstr "Publipostage" msgid "Outgoing Mails" msgstr "Courriels sortants" -#. module: mail_tracking_mass_mailing -#: code:addons/mail_tracking_mass_mailing/models/mail_mass_mailing.py:28 -#, python-format -msgid "" -"There is no more recipients to send and 'Avoid resend' option is enabled" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form #: field:mail.mail.statistics,tracking_event_ids:0 diff --git a/mail_tracking_mass_mailing/i18n/hr.po b/mail_tracking_mass_mailing/i18n/hr.po index 9db970f4..b37d47ec 100644 --- a/mail_tracking_mass_mailing/i18n/hr.po +++ b/mail_tracking_mass_mailing/i18n/hr.po @@ -18,16 +18,6 @@ msgstr "" "Language: hr\n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" -#. module: mail_tracking_mass_mailing -#: field:mail.mass_mailing,avoid_resend:0 -msgid "Avoid resend" -msgstr "" - -#. module: mail_tracking_mass_mailing -#: help:mail.mass_mailing,avoid_resend:0 -msgid "Avoid to send this mass mailing email twice to the same recipient" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form msgid "Country" @@ -121,13 +111,6 @@ msgstr "" msgid "Outgoing Mails" msgstr "" -#. module: mail_tracking_mass_mailing -#: code:addons/mail_tracking_mass_mailing/models/mail_mass_mailing.py:28 -#, python-format -msgid "" -"There is no more recipients to send and 'Avoid resend' option is enabled" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form #: field:mail.mail.statistics,tracking_event_ids:0 diff --git a/mail_tracking_mass_mailing/i18n/it.po b/mail_tracking_mass_mailing/i18n/it.po index b2ea3157..57362c95 100644 --- a/mail_tracking_mass_mailing/i18n/it.po +++ b/mail_tracking_mass_mailing/i18n/it.po @@ -19,16 +19,6 @@ msgstr "" "Language: it\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. module: mail_tracking_mass_mailing -#: field:mail.mass_mailing,avoid_resend:0 -msgid "Avoid resend" -msgstr "" - -#. module: mail_tracking_mass_mailing -#: help:mail.mass_mailing,avoid_resend:0 -msgid "Avoid to send this mass mailing email twice to the same recipient" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form msgid "Country" @@ -122,13 +112,6 @@ msgstr "" msgid "Outgoing Mails" msgstr "Mail in Uscita" -#. module: mail_tracking_mass_mailing -#: code:addons/mail_tracking_mass_mailing/models/mail_mass_mailing.py:28 -#, python-format -msgid "" -"There is no more recipients to send and 'Avoid resend' option is enabled" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form #: field:mail.mail.statistics,tracking_event_ids:0 diff --git a/mail_tracking_mass_mailing/i18n/pt.po b/mail_tracking_mass_mailing/i18n/pt.po index 873ed8ee..4fc774d2 100644 --- a/mail_tracking_mass_mailing/i18n/pt.po +++ b/mail_tracking_mass_mailing/i18n/pt.po @@ -18,16 +18,6 @@ msgstr "" "Language: pt\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. module: mail_tracking_mass_mailing -#: field:mail.mass_mailing,avoid_resend:0 -msgid "Avoid resend" -msgstr "" - -#. module: mail_tracking_mass_mailing -#: help:mail.mass_mailing,avoid_resend:0 -msgid "Avoid to send this mass mailing email twice to the same recipient" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form msgid "Country" @@ -121,13 +111,6 @@ msgstr "" msgid "Outgoing Mails" msgstr "" -#. module: mail_tracking_mass_mailing -#: code:addons/mail_tracking_mass_mailing/models/mail_mass_mailing.py:28 -#, python-format -msgid "" -"There is no more recipients to send and 'Avoid resend' option is enabled" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form #: field:mail.mail.statistics,tracking_event_ids:0 diff --git a/mail_tracking_mass_mailing/i18n/pt_BR.po b/mail_tracking_mass_mailing/i18n/pt_BR.po index 80f53d7f..516c9eec 100644 --- a/mail_tracking_mass_mailing/i18n/pt_BR.po +++ b/mail_tracking_mass_mailing/i18n/pt_BR.po @@ -19,16 +19,6 @@ msgstr "" "Language: pt_BR\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#. module: mail_tracking_mass_mailing -#: field:mail.mass_mailing,avoid_resend:0 -msgid "Avoid resend" -msgstr "" - -#. module: mail_tracking_mass_mailing -#: help:mail.mass_mailing,avoid_resend:0 -msgid "Avoid to send this mass mailing email twice to the same recipient" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form msgid "Country" @@ -122,13 +112,6 @@ msgstr "" msgid "Outgoing Mails" msgstr "Mails de Saída" -#. module: mail_tracking_mass_mailing -#: code:addons/mail_tracking_mass_mailing/models/mail_mass_mailing.py:28 -#, python-format -msgid "" -"There is no more recipients to send and 'Avoid resend' option is enabled" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form #: field:mail.mail.statistics,tracking_event_ids:0 diff --git a/mail_tracking_mass_mailing/i18n/sl.po b/mail_tracking_mass_mailing/i18n/sl.po index 0bd40aa3..112759fc 100644 --- a/mail_tracking_mass_mailing/i18n/sl.po +++ b/mail_tracking_mass_mailing/i18n/sl.po @@ -19,16 +19,6 @@ msgstr "" "Language: sl\n" "Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" -#. module: mail_tracking_mass_mailing -#: field:mail.mass_mailing,avoid_resend:0 -msgid "Avoid resend" -msgstr "Izogibaj se ponovnemu pošiljanju" - -#. module: mail_tracking_mass_mailing -#: help:mail.mass_mailing,avoid_resend:0 -msgid "Avoid to send this mass mailing email twice to the same recipient" -msgstr "Izogibaj se dvakratnemu masovnemu pošiljanju istemu prejemniku." - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form msgid "Country" @@ -122,15 +112,6 @@ msgstr "Masovna pošta" msgid "Outgoing Mails" msgstr "Izhodna pošta" -#. module: mail_tracking_mass_mailing -#: code:addons/mail_tracking_mass_mailing/models/mail_mass_mailing.py:28 -#, python-format -msgid "" -"There is no more recipients to send and 'Avoid resend' option is enabled" -msgstr "" -"Ni več potencialnih prejemnikov, pa tudi opcija 'Izogibaj se ponovnemu " -"pošiljanju' je omogočena." - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form #: field:mail.mail.statistics,tracking_event_ids:0 diff --git a/mail_tracking_mass_mailing/i18n/tr.po b/mail_tracking_mass_mailing/i18n/tr.po index 74194bed..06ca3df5 100644 --- a/mail_tracking_mass_mailing/i18n/tr.po +++ b/mail_tracking_mass_mailing/i18n/tr.po @@ -19,16 +19,6 @@ msgstr "" "Language: tr\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#. module: mail_tracking_mass_mailing -#: field:mail.mass_mailing,avoid_resend:0 -msgid "Avoid resend" -msgstr "" - -#. module: mail_tracking_mass_mailing -#: help:mail.mass_mailing,avoid_resend:0 -msgid "Avoid to send this mass mailing email twice to the same recipient" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form msgid "Country" @@ -122,13 +112,6 @@ msgstr "" msgid "Outgoing Mails" msgstr "" -#. module: mail_tracking_mass_mailing -#: code:addons/mail_tracking_mass_mailing/models/mail_mass_mailing.py:28 -#, python-format -msgid "" -"There is no more recipients to send and 'Avoid resend' option is enabled" -msgstr "" - #. module: mail_tracking_mass_mailing #: view:mail.mail.statistics:mail_tracking_mass_mailing.view_mail_mail_statistics_form #: field:mail.mail.statistics,tracking_event_ids:0 diff --git a/mail_tracking_mass_mailing/models/__init__.py b/mail_tracking_mass_mailing/models/__init__.py index 94fdb95c..4b0c3183 100644 --- a/mail_tracking_mass_mailing/models/__init__.py +++ b/mail_tracking_mass_mailing/models/__init__.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# © 2016 Antonio Espinosa - +# Copyright 2016 Antonio Espinosa - +# Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import mail_mail from . import mail_tracking_email from . import mail_tracking_event from . import mail_mail_statistics -from . import mail_mass_mailing from . import mail_mass_mailing_contact diff --git a/mail_tracking_mass_mailing/models/mail_mail.py b/mail_tracking_mass_mailing/models/mail_mail.py index 952d3b42..112caceb 100644 --- a/mail_tracking_mass_mailing/models/mail_mail.py +++ b/mail_tracking_mass_mailing/models/mail_mail.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# © 2016 Antonio Espinosa - +# Copyright 2016 Antonio Espinosa - +# Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, api @@ -9,13 +10,13 @@ class MailMail(models.Model): _inherit = "mail.mail" @api.model - def _tracking_email_prepare(self, mail, partner, email): + def _tracking_email_prepare(self, partner, email): res = super(MailMail, self)._tracking_email_prepare( - mail, partner, email) - res['mail_id_int'] = mail.id - res['mass_mailing_id'] = mail.mailing_id.id - res['mail_stats_id'] = mail.statistics_ids[:1].id \ - if mail.statistics_ids else False + partner, email) + res['mail_id_int'] = self.id + res['mass_mailing_id'] = self.mailing_id.id + res['mail_stats_id'] = self.statistics_ids[:1].id \ + if self.statistics_ids else False return res @api.model diff --git a/mail_tracking_mass_mailing/models/mail_mail_statistics.py b/mail_tracking_mass_mailing/models/mail_mail_statistics.py index dbcfe9bd..1e939fa9 100644 --- a/mail_tracking_mass_mailing/models/mail_mail_statistics.py +++ b/mail_tracking_mass_mailing/models/mail_mail_statistics.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# © 2016 Antonio Espinosa - +# Copyright 2016 Antonio Espinosa - +# Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields diff --git a/mail_tracking_mass_mailing/models/mail_mass_mailing.py b/mail_tracking_mass_mailing/models/mail_mass_mailing.py deleted file mode 100644 index db32bc8d..00000000 --- a/mail_tracking_mass_mailing/models/mail_mass_mailing.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2016 Antonio Espinosa - -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from openerp import models, api, fields, _ -from openerp.exceptions import Warning as UserError - - -class MailMassMailing(models.Model): - _inherit = 'mail.mass_mailing' - - avoid_resend = fields.Boolean( - string="Avoid resend", - help="Avoid to send this mass mailing email twice " - "to the same recipient") - - @api.model - def get_recipients(self, mailing): - res_ids = super(MailMassMailing, self).get_recipients(mailing) - if mailing.avoid_resend: - already_sent = self.env['mail.mail.statistics'].search([ - ('mass_mailing_id', '=', mailing.id), - ('model', '=', mailing.mailing_model), - ]) - res_ids = list(set(res_ids).difference( - already_sent.mapped('res_id'))) - if not res_ids: - raise UserError(_( - "There is no more recipients to send and 'Avoid resend' " - "option is enabled")) - return res_ids 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 4edbcf6b..79c156e8 100644 --- a/mail_tracking_mass_mailing/models/mail_mass_mailing_contact.py +++ b/mail_tracking_mass_mailing/models/mail_mass_mailing_contact.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# © 2016 Antonio Espinosa - +# Copyright 2016 Antonio Espinosa - +# Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, api, fields diff --git a/mail_tracking_mass_mailing/models/mail_tracking_email.py b/mail_tracking_mass_mailing/models/mail_tracking_email.py index 83aca64f..7570f0dd 100644 --- a/mail_tracking_mass_mailing/models/mail_tracking_email.py +++ b/mail_tracking_mass_mailing/models/mail_tracking_email.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# © 2016 Antonio Espinosa - +# Copyright 2016 Antonio Espinosa - +# Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields, api diff --git a/mail_tracking_mass_mailing/models/mail_tracking_event.py b/mail_tracking_mass_mailing/models/mail_tracking_event.py index f18d5166..b063c577 100644 --- a/mail_tracking_mass_mailing/models/mail_tracking_event.py +++ b/mail_tracking_mass_mailing/models/mail_tracking_event.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# © 2016 Antonio Espinosa - +# Copyright 2016 Antonio Espinosa - +# Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import api, fields, models diff --git a/mail_tracking_mass_mailing/tests/__init__.py b/mail_tracking_mass_mailing/tests/__init__.py index b804cd49..bdcac9c1 100644 --- a/mail_tracking_mass_mailing/tests/__init__.py +++ b/mail_tracking_mass_mailing/tests/__init__.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- -# © 2016 Antonio Espinosa - +# Copyright 2016 Antonio Espinosa - +# Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import test_mass_mailing diff --git a/mail_tracking_mass_mailing/tests/test_mass_mailing.py b/mail_tracking_mass_mailing/tests/test_mass_mailing.py index d086d736..671aa6ee 100644 --- a/mail_tracking_mass_mailing/tests/test_mass_mailing.py +++ b/mail_tracking_mass_mailing/tests/test_mass_mailing.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# © 2016 Antonio Espinosa - +# Copyright 2016 Antonio Espinosa - +# Copyright 2017 Vicent Cubells - # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import mock from openerp.tests.common import TransactionCase -from openerp.exceptions import Warning as UserError mock_send_email = ('openerp.addons.base.ir.ir_mail_server.' 'ir_mail_server.send_email') @@ -16,6 +16,7 @@ class TestMassMailing(TransactionCase): self.list = self.env['mail.mass_mailing.list'].create({ 'name': 'Test mail tracking', }) + self.list.name = '%s #%s' % (self.list.name, self.list.id) self.contact_a = self.env['mail.mass_mailing.contact'].create({ 'list_id': self.list.id, 'name': 'Test contact A', @@ -32,27 +33,6 @@ class TestMassMailing(TransactionCase): 'reply_to_mode': 'email', }) - def resend_mass_mailing(self, first, second): - self.mailing.send_mail() - self.assertEqual(len(self.mailing.statistics_ids), first) - self.env['mail.mass_mailing.contact'].create({ - 'list_id': self.list.id, - 'name': 'Test contact B', - 'email': 'contact_b@example.com', - }) - self.mailing.send_mail() - self.assertEqual(len(self.mailing.statistics_ids), second) - - def test_avoid_resend_enable(self): - self.mailing.avoid_resend = True - self.resend_mass_mailing(1, 2) - with self.assertRaises(UserError): - self.mailing.send_mail() - - def test_avoid_resend_disable(self): - self.mailing.avoid_resend = False - self.resend_mass_mailing(1, 3) - def test_smtp_error(self): with mock.patch(mock_send_email) as mock_func: mock_func.side_effect = Warning('Test error') @@ -63,9 +43,10 @@ class TestMassMailing(TransactionCase): tracking = self.env['mail.tracking.email'].search([ ('mail_id_int', '=', stat.mail_mail_id_int), ]) - self.assertEqual('error', tracking.state) - self.assertEqual('Warning', tracking.error_type) - self.assertEqual('Test error', tracking.error_description) + for track in tracking: + self.assertEqual('error', track.state) + self.assertEqual('Warning', track.error_type) + self.assertEqual('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_mail_statistics_view.xml b/mail_tracking_mass_mailing/views/mail_mail_statistics_view.xml index d67ddd21..331ab066 100644 --- a/mail_tracking_mass_mailing/views/mail_mail_statistics_view.xml +++ b/mail_tracking_mass_mailing/views/mail_mail_statistics_view.xml @@ -1,8 +1,8 @@ - - - + Add tracking email info @@ -31,5 +31,4 @@ - - + diff --git a/mail_tracking_mass_mailing/views/mail_mass_mailing_contact_view.xml b/mail_tracking_mass_mailing/views/mail_mass_mailing_contact_view.xml index 967cabcc..ea6b2fdc 100644 --- a/mail_tracking_mass_mailing/views/mail_mass_mailing_contact_view.xml +++ b/mail_tracking_mass_mailing/views/mail_mass_mailing_contact_view.xml @@ -1,8 +1,8 @@ - - - + Add email score and stars @@ -28,5 +28,4 @@ - - + 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 b0c0ae4c..01626f4d 100644 --- a/mail_tracking_mass_mailing/views/mail_mass_mailing_view.xml +++ b/mail_tracking_mass_mailing/views/mail_mass_mailing_view.xml @@ -1,19 +1,8 @@ - - - - - - Add avoid resend field - mail.mass_mailing - - - - - - - + Mail tracking emails @@ -42,5 +31,4 @@ parent="mail_tracking_menu" sequence="2" action="action_view_mail_tracking_event"/> - - + diff --git a/mail_tracking_mass_mailing/views/mail_tracking_email_view.xml b/mail_tracking_mass_mailing/views/mail_tracking_email_view.xml index 5549650e..0a38ed0e 100644 --- a/mail_tracking_mass_mailing/views/mail_tracking_email_view.xml +++ b/mail_tracking_mass_mailing/views/mail_tracking_email_view.xml @@ -1,8 +1,8 @@ - - - + Add mass mailing and mail stadistics @@ -16,5 +16,4 @@ - - +