diff --git a/mass_mailing_resend/README.rst b/mass_mailing_resend/README.rst new file mode 100644 index 00000000..e3259852 --- /dev/null +++ b/mass_mailing_resend/README.rst @@ -0,0 +1,104 @@ +==================== +Resend mass mailings +==================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github + :target: https://github.com/OCA/social/tree/11.0/mass_mailing_resend + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-11-0/social-11-0-mass_mailing_resend + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/205/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +A frequent need for users of mass mailings is to resend one mailing that has +already been sent in the past to new recipients that haven't received yet that +mail. But the problem is to know which are the applicable ones. + +Odoo already includes a method in its mass mailing logic that avoids to resend +the same mail 2 times for one mass mailing, and for v9, there was a trick that +allows to modify the state of a mass mailing from kanban view, covering the +need. + +But now since v10 both status bar in form view and dragging between states in +kanban are not allowed. + +This module introduces a button to restart a mass mailing to draft state, +allowing you to reevaluate the sending domain or list for performing again +the mailing. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +* Go to *Email marketing > Mailings > Mass Mailings*. +* Click on one record that is done or create a new one and send it. +* You will see a button called "Resend". +* If you click on it, mass mailing will be set to Draft again. + +Known issues / Roadmap +====================== + +* Add an indicator / filter for knowing resent mailings. +* Include information on the number of new recipients to be sent on the + resending (through `get_remaining_recipients` method). + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_: + + * Pedro M. Baeza + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/social `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mass_mailing_resend/__init__.py b/mass_mailing_resend/__init__.py new file mode 100644 index 00000000..a77a6fcb --- /dev/null +++ b/mass_mailing_resend/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/mass_mailing_resend/__manifest__.py b/mass_mailing_resend/__manifest__.py new file mode 100644 index 00000000..6c6a103b --- /dev/null +++ b/mass_mailing_resend/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2017-2018 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + "name": "Resend mass mailings", + "version": "11.0.1.0.0", + "category": "Marketing", + "website": "https://github.com/OCA/social", + "author": "Tecnativa, " + "Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": [ + "mass_mailing", + ], + "data": [ + "views/mass_mailing_views.xml", + ], +} diff --git a/mass_mailing_resend/i18n/ca.po b/mass_mailing_resend/i18n/ca.po new file mode 100644 index 00000000..1b59b487 --- /dev/null +++ b/mass_mailing_resend/i18n/ca.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mass_mailing_resend +# +# Translators: +# OCA Transbot , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-24 03:51+0000\n" +"PO-Revision-Date: 2018-01-24 03:51+0000\n" +"Last-Translator: OCA Transbot , 2018\n" +"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mass_mailing_resend +#: model:ir.ui.view,arch_db:mass_mailing_resend.view_mail_mass_mailing_form +msgid "" +" New sending will be done only to not sent/" +"new recipients. If you want to resend again the mass mailing to already sent " +"recipients, click on Emails Sent smart-button for removing the " +"existing record(s)." +msgstr "" + +#. module: mass_mailing_resend +#: model:ir.model,name:mass_mailing_resend.model_mail_mass_mailing +msgid "Mass Mailing" +msgstr "Correu massiu" + +#. module: mass_mailing_resend +#: model:ir.ui.view,arch_db:mass_mailing_resend.view_mail_mass_mailing_form +msgid "Resend" +msgstr "" + +#. module: mass_mailing_resend +#: code:addons/mass_mailing_resend/models/mass_mailing.py:16 +#, python-format +msgid "You can't resend a mass mailing that is being sent or in draft state." +msgstr "" diff --git a/mass_mailing_resend/i18n/de.po b/mass_mailing_resend/i18n/de.po new file mode 100644 index 00000000..d9f24fae --- /dev/null +++ b/mass_mailing_resend/i18n/de.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mass_mailing_resend +# +# Translators: +# OCA Transbot , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-24 03:51+0000\n" +"PO-Revision-Date: 2018-01-24 03:51+0000\n" +"Last-Translator: OCA Transbot , 2018\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mass_mailing_resend +#: model:ir.ui.view,arch_db:mass_mailing_resend.view_mail_mass_mailing_form +msgid "" +" New sending will be done only to not sent/" +"new recipients. If you want to resend again the mass mailing to already sent " +"recipients, click on Emails Sent smart-button for removing the " +"existing record(s)." +msgstr "" + +#. module: mass_mailing_resend +#: model:ir.model,name:mass_mailing_resend.model_mail_mass_mailing +msgid "Mass Mailing" +msgstr "Massenmailing" + +#. module: mass_mailing_resend +#: model:ir.ui.view,arch_db:mass_mailing_resend.view_mail_mass_mailing_form +msgid "Resend" +msgstr "" + +#. module: mass_mailing_resend +#: code:addons/mass_mailing_resend/models/mass_mailing.py:16 +#, python-format +msgid "You can't resend a mass mailing that is being sent or in draft state." +msgstr "" diff --git a/mass_mailing_resend/i18n/es.po b/mass_mailing_resend/i18n/es.po new file mode 100644 index 00000000..0e0c6d3d --- /dev/null +++ b/mass_mailing_resend/i18n/es.po @@ -0,0 +1,48 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mass_mailing_resend +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-11-22 10:42+0000\n" +"PO-Revision-Date: 2017-11-22 10:42+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: mass_mailing_resend +#: model:ir.ui.view,arch_db:mass_mailing_resend.view_mail_mass_mailing_form +msgid "" +" New sending will be done only to not sent/" +"new recipients. If you want to resend again the mass mailing to already sent " +"recipients, click on Emails Sent smart-button for removing the " +"existing record(s)." +msgstr "" +" El nuevo envío se realizará solo a los " +"destinatarios no enviados/nuevos. Si quiere reenviar otra vez el correo " +"masivo a destinatarios ya enviados, pulse en el botón Correos enviados para eliminar el/los registro/s existentes." + +#. module: mass_mailing_resend +#: model:ir.model,name:mass_mailing_resend.model_mail_mass_mailing +msgid "Mass Mailing" +msgstr "Correo masivo" + +#. module: mass_mailing_resend +#: model:ir.ui.view,arch_db:mass_mailing_resend.view_mail_mass_mailing_form +msgid "Resend" +msgstr "Reenviar" + +#. module: mass_mailing_resend +#: code:addons/mass_mailing_resend/models/mass_mailing.py:16 +#, python-format +msgid "You can't resend a mass mailing that is being sent or in draft state." +msgstr "" +"No puede reenviar un correo masivo que está siendo enviado en estado " +"borrador." diff --git a/mass_mailing_resend/i18n/fr.po b/mass_mailing_resend/i18n/fr.po new file mode 100644 index 00000000..e7b14bb4 --- /dev/null +++ b/mass_mailing_resend/i18n/fr.po @@ -0,0 +1,52 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mass_mailing_resend +# +# Translators: +# OCA Transbot , 2018 +# Quentin THEURET , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-26 01:46+0000\n" +"PO-Revision-Date: 2018-02-26 01:46+0000\n" +"Last-Translator: Quentin THEURET , 2018\n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: mass_mailing_resend +#: model:ir.ui.view,arch_db:mass_mailing_resend.view_mail_mass_mailing_form +msgid "" +" New sending will be done only to not sent/" +"new recipients. If you want to resend again the mass mailing to already sent " +"recipients, click on Emails Sent smart-button for removing the " +"existing record(s)." +msgstr "" +"Un nouvel envoi sera effectué uniquement aux " +"nouveaux destinataires ou à ceux qui ne l'ont pas encore reçu. Si vous " +"souhaitez envoyer à nouveau le publipostage à tous les destinataires, " +"cliquez sur le bouton Courriels envoyéspour supprimer le(s) " +"enregistrement(s) existant(s)." + +#. module: mass_mailing_resend +#: model:ir.model,name:mass_mailing_resend.model_mail_mass_mailing +msgid "Mass Mailing" +msgstr "Publipostage" + +#. module: mass_mailing_resend +#: model:ir.ui.view,arch_db:mass_mailing_resend.view_mail_mass_mailing_form +msgid "Resend" +msgstr "Renvoyer" + +#. module: mass_mailing_resend +#: code:addons/mass_mailing_resend/models/mass_mailing.py:16 +#, python-format +msgid "You can't resend a mass mailing that is being sent or in draft state." +msgstr "" +"Vous ne pouvez pas renvoyer un publipostage qui est déjà envoyé ou dans un " +"état brouillon." diff --git a/mass_mailing_resend/i18n/mass_mailing_resend.pot b/mass_mailing_resend/i18n/mass_mailing_resend.pot new file mode 100644 index 00000000..e05b393d --- /dev/null +++ b/mass_mailing_resend/i18n/mass_mailing_resend.pot @@ -0,0 +1,36 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mass_mailing_resend +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: mass_mailing_resend +#: model:ir.ui.view,arch_db:mass_mailing_resend.view_mail_mass_mailing_form +msgid " New sending will be done only to not sent/new recipients. If you want to resend again the mass mailing to already sent recipients, click on Emails Sent smart-button for removing the existing record(s)." +msgstr "" + +#. module: mass_mailing_resend +#: model:ir.model,name:mass_mailing_resend.model_mail_mass_mailing +msgid "Mass Mailing" +msgstr "" + +#. module: mass_mailing_resend +#: model:ir.ui.view,arch_db:mass_mailing_resend.view_mail_mass_mailing_form +msgid "Resend" +msgstr "" + +#. module: mass_mailing_resend +#: code:addons/mass_mailing_resend/models/mass_mailing.py:16 +#, python-format +msgid "You can't resend a mass mailing that is being sent or in draft state." +msgstr "" + diff --git a/mass_mailing_resend/i18n/sl.po b/mass_mailing_resend/i18n/sl.po new file mode 100644 index 00000000..b70a89cc --- /dev/null +++ b/mass_mailing_resend/i18n/sl.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mass_mailing_resend +# +# Translators: +# OCA Transbot , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-24 03:51+0000\n" +"PO-Revision-Date: 2018-01-24 03:51+0000\n" +"Last-Translator: OCA Transbot , 2018\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" + +#. module: mass_mailing_resend +#: model:ir.ui.view,arch_db:mass_mailing_resend.view_mail_mass_mailing_form +msgid "" +" New sending will be done only to not sent/" +"new recipients. If you want to resend again the mass mailing to already sent " +"recipients, click on Emails Sent smart-button for removing the " +"existing record(s)." +msgstr "" + +#. module: mass_mailing_resend +#: model:ir.model,name:mass_mailing_resend.model_mail_mass_mailing +msgid "Mass Mailing" +msgstr "Masovno razpošiljanje" + +#. module: mass_mailing_resend +#: model:ir.ui.view,arch_db:mass_mailing_resend.view_mail_mass_mailing_form +msgid "Resend" +msgstr "" + +#. module: mass_mailing_resend +#: code:addons/mass_mailing_resend/models/mass_mailing.py:16 +#, python-format +msgid "You can't resend a mass mailing that is being sent or in draft state." +msgstr "" diff --git a/mass_mailing_resend/models/__init__.py b/mass_mailing_resend/models/__init__.py new file mode 100644 index 00000000..57344fa0 --- /dev/null +++ b/mass_mailing_resend/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import mass_mailing diff --git a/mass_mailing_resend/models/mass_mailing.py b/mass_mailing_resend/models/mass_mailing.py new file mode 100644 index 00000000..baec0e50 --- /dev/null +++ b/mass_mailing_resend/models/mass_mailing.py @@ -0,0 +1,18 @@ +# Copyright 2017 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + + +from odoo import _, exceptions, models + + +class MailMassMailingList(models.Model): + _inherit = "mail.mass_mailing" + + def button_draft(self): + """Return to draft state for resending the mass mailing.""" + if any(self.mapped(lambda x: x.state != 'done')): + raise exceptions.UserError( + _("You can't resend a mass mailing that is being sent or in " + "draft state.") + ) + self.write({'state': 'draft'}) diff --git a/mass_mailing_resend/readme/CONTRIBUTORS.rst b/mass_mailing_resend/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..2d4d7a88 --- /dev/null +++ b/mass_mailing_resend/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Tecnativa `_: + + * Pedro M. Baeza diff --git a/mass_mailing_resend/readme/DESCRIPTION.rst b/mass_mailing_resend/readme/DESCRIPTION.rst new file mode 100644 index 00000000..67035819 --- /dev/null +++ b/mass_mailing_resend/readme/DESCRIPTION.rst @@ -0,0 +1,15 @@ +A frequent need for users of mass mailings is to resend one mailing that has +already been sent in the past to new recipients that haven't received yet that +mail. But the problem is to know which are the applicable ones. + +Odoo already includes a method in its mass mailing logic that avoids to resend +the same mail 2 times for one mass mailing, and for v9, there was a trick that +allows to modify the state of a mass mailing from kanban view, covering the +need. + +But now since v10 both status bar in form view and dragging between states in +kanban are not allowed. + +This module introduces a button to restart a mass mailing to draft state, +allowing you to reevaluate the sending domain or list for performing again +the mailing. diff --git a/mass_mailing_resend/readme/ROADMAP.rst b/mass_mailing_resend/readme/ROADMAP.rst new file mode 100644 index 00000000..494b75ad --- /dev/null +++ b/mass_mailing_resend/readme/ROADMAP.rst @@ -0,0 +1,3 @@ +* Add an indicator / filter for knowing resent mailings. +* Include information on the number of new recipients to be sent on the + resending (through `get_remaining_recipients` method). diff --git a/mass_mailing_resend/readme/USAGE.rst b/mass_mailing_resend/readme/USAGE.rst new file mode 100644 index 00000000..a41cdf18 --- /dev/null +++ b/mass_mailing_resend/readme/USAGE.rst @@ -0,0 +1,4 @@ +* Go to *Email marketing > Mailings > Mass Mailings*. +* Click on one record that is done or create a new one and send it. +* You will see a button called "Resend". +* If you click on it, mass mailing will be set to Draft again. diff --git a/mass_mailing_resend/static/description/icon.png b/mass_mailing_resend/static/description/icon.png new file mode 100644 index 00000000..7828a2dc Binary files /dev/null and b/mass_mailing_resend/static/description/icon.png differ diff --git a/mass_mailing_resend/static/description/icon.svg b/mass_mailing_resend/static/description/icon.svg new file mode 100644 index 00000000..1e7db975 --- /dev/null +++ b/mass_mailing_resend/static/description/icon.svg @@ -0,0 +1,84 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/mass_mailing_resend/tests/__init__.py b/mass_mailing_resend/tests/__init__.py new file mode 100644 index 00000000..6b595861 --- /dev/null +++ b/mass_mailing_resend/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import test_mass_mailing_resend diff --git a/mass_mailing_resend/tests/test_mass_mailing_resend.py b/mass_mailing_resend/tests/test_mass_mailing_resend.py new file mode 100644 index 00000000..c6c10dc9 --- /dev/null +++ b/mass_mailing_resend/tests/test_mass_mailing_resend.py @@ -0,0 +1,37 @@ +# Copyright 2017-2018 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.tests import common +from odoo import exceptions + + +class TestMassMailingResend(common.SavepointCase): + @classmethod + def setUpClass(cls): + super(TestMassMailingResend, cls).setUpClass() + cls.list = cls.env['mail.mass_mailing.list'].create({ + 'name': 'Test list', + }) + cls.contact1 = cls.env['mail.mass_mailing.contact'].create({ + 'name': 'Contact 1', + 'email': 'email1@test.com', + }) + cls.mass_mailing = cls.env['mail.mass_mailing'].create({ + 'name': 'Test mass mailing', + 'email_from': 'test@example.org', + 'mailing_model_id': cls.env.ref( + 'mass_mailing.model_mail_mass_mailing_contact' + ).id, + 'contact_list_ids': [(6, 0, cls.list.ids)], + 'reply_to_mode': 'thread', + }) + + def test_resend_error(self): + with self.assertRaises(exceptions.UserError): + self.mass_mailing.button_draft() + + def test_resend(self): + self.mass_mailing.state = 'done' # Force state + self.assertEqual(self.mass_mailing.state, 'done') + self.mass_mailing.button_draft() + self.assertEqual(self.mass_mailing.state, 'draft') diff --git a/mass_mailing_resend/views/mass_mailing_views.xml b/mass_mailing_resend/views/mass_mailing_views.xml new file mode 100644 index 00000000..e25d1997 --- /dev/null +++ b/mass_mailing_resend/views/mass_mailing_views.xml @@ -0,0 +1,28 @@ + + + + + mail.mass_mailing + + + +