Browse Source

mail_tracking_mass_mailing module

pull/319/head
cubells 8 years ago
committed by ernesto
parent
commit
24f41b3e3d
  1. 12
      mail_tracking_mass_mailing/README.rst
  2. 3
      mail_tracking_mass_mailing/__init__.py
  3. 5
      mail_tracking_mass_mailing/__openerp__.py
  4. 3
      mail_tracking_mass_mailing/hooks.py
  5. 17
      mail_tracking_mass_mailing/i18n/ca.po
  6. 17
      mail_tracking_mass_mailing/i18n/de.po
  7. 17
      mail_tracking_mass_mailing/i18n/el_GR.po
  8. 18
      mail_tracking_mass_mailing/i18n/es.po
  9. 17
      mail_tracking_mass_mailing/i18n/es_CO.po
  10. 17
      mail_tracking_mass_mailing/i18n/fr.po
  11. 17
      mail_tracking_mass_mailing/i18n/hr.po
  12. 17
      mail_tracking_mass_mailing/i18n/it.po
  13. 17
      mail_tracking_mass_mailing/i18n/pt.po
  14. 17
      mail_tracking_mass_mailing/i18n/pt_BR.po
  15. 19
      mail_tracking_mass_mailing/i18n/sl.po
  16. 17
      mail_tracking_mass_mailing/i18n/tr.po
  17. 4
      mail_tracking_mass_mailing/models/__init__.py
  18. 15
      mail_tracking_mass_mailing/models/mail_mail.py
  19. 3
      mail_tracking_mass_mailing/models/mail_mail_statistics.py
  20. 31
      mail_tracking_mass_mailing/models/mail_mass_mailing.py
  21. 3
      mail_tracking_mass_mailing/models/mail_mass_mailing_contact.py
  22. 3
      mail_tracking_mass_mailing/models/mail_tracking_email.py
  23. 3
      mail_tracking_mass_mailing/models/mail_tracking_event.py
  24. 3
      mail_tracking_mass_mailing/tests/__init__.py
  25. 33
      mail_tracking_mass_mailing/tests/test_mass_mailing.py
  26. 9
      mail_tracking_mass_mailing/views/mail_mail_statistics_view.xml
  27. 9
      mail_tracking_mass_mailing/views/mail_mass_mailing_contact_view.xml
  28. 20
      mail_tracking_mass_mailing/views/mail_mass_mailing_view.xml
  29. 9
      mail_tracking_mass_mailing/views/mail_tracking_email_view.xml

12
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 <pedro.baeza@tecnativa.com>
* Antonio Espinosa <antonio.espinosa@tecnativa.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
Maintainer
----------

3
mail_tracking_mass_mailing/__init__.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models

5
mail_tracking_mass_mailing/__openerp__.py

@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# 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, "

3
mail_tracking_mass_mailing/hooks.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging

17
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"

17
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

17
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

18
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

17
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"

17
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

17
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

17
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

17
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

17
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

19
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

17
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

4
mail_tracking_mass_mailing/models/__init__.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# 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

15
mail_tracking_mass_mailing/models/mail_mail.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# 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

3
mail_tracking_mass_mailing/models/mail_mail_statistics.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields

31
mail_tracking_mass_mailing/models/mail_mass_mailing.py

@ -1,31 +0,0 @@
# -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# 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

3
mail_tracking_mass_mailing/models/mail_mass_mailing_contact.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, api, fields

3
mail_tracking_mass_mailing/models/mail_tracking_email.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api

3
mail_tracking_mass_mailing/models/mail_tracking_event.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, fields, models

3
mail_tracking_mass_mailing/tests/__init__.py

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_mass_mailing

33
mail_tracking_mass_mailing/tests/test_mass_mailing.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
# Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
# 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):

9
mail_tracking_mass_mailing/views/mail_mail_statistics_view.xml

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
<!-- Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
<odoo>
<record model="ir.ui.view" id="view_mail_mail_statistics_form">
<field name="name">Add tracking email info</field>
@ -31,5 +31,4 @@
</field>
</record>
</data>
</openerp>
</odoo>

9
mail_tracking_mass_mailing/views/mail_mass_mailing_contact_view.xml

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
<!-- Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
<odoo>
<record model="ir.ui.view" id="view_mail_mass_mailing_contact_tree">
<field name="name">Add email score and stars</field>
@ -28,5 +28,4 @@
</field>
</record>
</data>
</openerp>
</odoo>

20
mail_tracking_mass_mailing/views/mail_mass_mailing_view.xml

@ -1,19 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
<!-- Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
<record model="ir.ui.view" id="view_mail_mass_mailing_form">
<field name="name">Add avoid resend field</field>
<field name="model">mail.mass_mailing</field>
<field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_form"/>
<field name="arch" type="xml">
<field name="mass_mailing_campaign_id" position="before">
<field name="avoid_resend"/>
</field>
</field>
</record>
<odoo>
<record model="ir.actions.act_window" id="action_view_mail_tracking_email">
<field name="name">Mail tracking emails</field>
@ -42,5 +31,4 @@
parent="mail_tracking_menu" sequence="2"
action="action_view_mail_tracking_event"/>
</data>
</openerp>
</odoo>

9
mail_tracking_mass_mailing/views/mail_tracking_email_view.xml

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
<!-- Copyright 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
Copyright 2017 Vicent Cubells - <vicent.cubells@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
<openerp>
<data>
<odoo>
<record model="ir.ui.view" id="view_mail_tracking_email_form">
<field name="name">Add mass mailing and mail stadistics</field>
@ -16,5 +16,4 @@
</field>
</record>
</data>
</openerp>
</odoo>
Loading…
Cancel
Save