Browse Source
[ADD] mass_mailing_resend (#210)
[ADD] mass_mailing_resend (#210)
* [ADD] mass_mailing_resend Resend mass mailings ==================== 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 on 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. Usage ===== * Go to *Mass mailing > 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).pull/294/head
Pedro M. Baeza
7 years ago
11 changed files with 313 additions and 0 deletions
-
75mass_mailing_resend/README.rst
-
4mass_mailing_resend/__init__.py
-
21mass_mailing_resend/__manifest__.py
-
38mass_mailing_resend/i18n/es.po
-
4mass_mailing_resend/models/__init__.py
-
19mass_mailing_resend/models/mass_mailing.py
-
BINmass_mailing_resend/static/description/icon.png
-
84mass_mailing_resend/static/description/icon.svg
-
4mass_mailing_resend/tests/__init__.py
-
36mass_mailing_resend/tests/test_mass_mailing_resend.py
-
28mass_mailing_resend/views/mass_mailing_views.xml
@ -0,0 +1,75 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
==================== |
|||
Resend mass mailings |
|||
==================== |
|||
|
|||
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 on 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. |
|||
|
|||
Usage |
|||
===== |
|||
|
|||
* Go to *Mass mailing > 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. |
|||
|
|||
.. 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/10.0 |
|||
|
|||
Bug Tracker |
|||
=========== |
|||
|
|||
Bugs are tracked on `GitHub Issues |
|||
<https://github.com/OCA/social/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. |
|||
|
|||
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). |
|||
|
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Tecnativa (https://www.tecnativa.com): |
|||
* Pedro M. Baeza <pedro.baeza@tecnativa.com> |
|||
|
|||
Maintainer |
|||
---------- |
|||
|
|||
.. image:: https://odoo-community.org/logo.png |
|||
:alt: Odoo Community Association |
|||
:target: https://odoo-community.org |
|||
|
|||
This module is maintained by the OCA. |
|||
|
|||
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. |
|||
|
|||
To contribute to this module, please visit https://odoo-community.org. |
@ -0,0 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from . import models |
@ -0,0 +1,21 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2017 Tecnativa - Pedro M. Baeza |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
{ |
|||
"name": "Resend mass mailings", |
|||
"version": "10.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", |
|||
], |
|||
} |
@ -0,0 +1,38 @@ |
|||
# 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" |
|||
"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 "<i class=\"fa fa-info-circle\"/> 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 <b>Emails Sent</b> smart-button for removing the existing record(s)." |
|||
msgstr "<i class=\"fa fa-info-circle\"/> 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 <b>Correos enviados</b> 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." |
|||
|
@ -0,0 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from . import mass_mailing |
@ -0,0 +1,19 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# 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'}) |
After Width: 128 | Height: 128 | Size: 5.8 KiB |
@ -0,0 +1,84 @@ |
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
|||
<!-- Created with Inkscape (http://www.inkscape.org/) --> |
|||
|
|||
<svg |
|||
xmlns:dc="http://purl.org/dc/elements/1.1/" |
|||
xmlns:cc="http://creativecommons.org/ns#" |
|||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
|||
xmlns:svg="http://www.w3.org/2000/svg" |
|||
xmlns="http://www.w3.org/2000/svg" |
|||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
|||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
|||
id="svg2" |
|||
version="1.1" |
|||
inkscape:version="0.91 r13725" |
|||
width="80" |
|||
height="80" |
|||
viewBox="0 0 80 80" |
|||
sodipodi:docname="icon.svg" |
|||
inkscape:export-filename="icon.png" |
|||
inkscape:export-xdpi="144" |
|||
inkscape:export-ydpi="144"> |
|||
<metadata |
|||
id="metadata8"> |
|||
<rdf:RDF> |
|||
<cc:Work |
|||
rdf:about=""> |
|||
<dc:format>image/svg+xml</dc:format> |
|||
<dc:type |
|||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> |
|||
<dc:title /> |
|||
</cc:Work> |
|||
</rdf:RDF> |
|||
</metadata> |
|||
<defs |
|||
id="defs6" /> |
|||
<sodipodi:namedview |
|||
pagecolor="#ffffff" |
|||
bordercolor="#666666" |
|||
borderopacity="1" |
|||
objecttolerance="10" |
|||
gridtolerance="10" |
|||
guidetolerance="10" |
|||
inkscape:pageopacity="0" |
|||
inkscape:pageshadow="2" |
|||
inkscape:window-width="1855" |
|||
inkscape:window-height="1056" |
|||
id="namedview4" |
|||
showgrid="false" |
|||
inkscape:zoom="4.17193" |
|||
inkscape:cx="62.570254" |
|||
inkscape:cy="19.555116" |
|||
inkscape:window-x="65" |
|||
inkscape:window-y="24" |
|||
inkscape:window-maximized="1" |
|||
inkscape:current-layer="svg2" /> |
|||
<rect |
|||
style="opacity:1;fill:#8c7f6c;fill-opacity:1;stroke:none;stroke-width:4.05708647;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" |
|||
id="rect3346" |
|||
width="80" |
|||
height="80" |
|||
x="0" |
|||
y="0" /> |
|||
<path |
|||
style="fill:#675d4f;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1" |
|||
d="M 12.344407,43.446175 -0.11984861,56.150127 0,80 41.707315,79.760303 58.366272,62.741801 64.718248,15.042055 Z" |
|||
id="path3344" |
|||
inkscape:connector-curvature="0" /> |
|||
<g |
|||
style="font-style:normal;font-weight:normal;font-size:36.70288086px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" |
|||
id="text3367"> |
|||
<path |
|||
d="m 33.459612,4.6216349 c 0,-0.5325195 -0.327704,-1.0035944 -0.798779,-1.2084096 C 32.169277,3.2084101 31.595794,3.3108177 31.227127,3.6999666 L 28.564529,6.3420824 C 25.676635,3.6180405 21.764665,2.0000005 17.729806,2.0000005 9.0661238,2.0000005 2,9.0661244 2,17.729807 c 0,8.663682 7.0661238,15.729806 15.729806,15.729806 4.690268,0 9.114276,-2.068634 12.104577,-5.673381 0.204816,-0.26626 0.204816,-0.655408 -0.04096,-0.880705 l -2.805968,-2.82645 c -0.14337,-0.122889 -0.327704,-0.184333 -0.512038,-0.184333 -0.184333,0.02048 -0.368667,0.102407 -0.471075,0.245778 -2.007188,2.601153 -5.017972,4.075822 -8.274533,4.075822 -5.775788,0 -10.4865373,-4.710749 -10.4865373,-10.486537 0,-5.775789 4.7107493,-10.4865378 10.4865373,-10.4865378 2.683079,0 5.222787,1.024076 7.14805,2.8059678 l -2.82645,2.82645 c -0.389148,0.368667 -0.491556,0.94215 -0.286741,1.413225 0.204815,0.491556 0.67589,0.81926 1.20841,0.81926 l 9.17572,0 c 0.716853,0 1.310817,-0.593964 1.310817,-1.310817 l 0,-9.1757201 z" |
|||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:FontAwesome;-inkscape-font-specification:FontAwesome;fill:#ffffff" |
|||
id="path3339" /> |
|||
</g> |
|||
<g |
|||
style="font-style:normal;font-weight:normal;font-size:54.74009323px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" |
|||
id="text3338"> |
|||
<path |
|||
d="m 66.470545,12.85352 c -0.610938,-0.427657 -1.435705,-0.458204 -2.077191,-0.06109 l -50.830086,29.32505 c -0.641486,0.366563 -1.038596,1.069143 -0.977502,1.802269 0.06109,0.763673 0.519298,1.405159 1.221877,1.680081 l 14.418149,5.895557 0,13.807211 c 0,0.79422 0.488751,1.527346 1.252424,1.832816 0.213829,0.09164 0.458204,0.122187 0.70258,0.122187 0.549844,0 1.069142,-0.213828 1.435705,-0.641485 l 9.102985,-9.988845 16.09823,6.567589 c 0.244376,0.09164 0.488751,0.152735 0.733126,0.152735 0.336017,0 0.672033,-0.09164 0.946955,-0.244376 0.519298,-0.305469 0.885861,-0.79422 0.977502,-1.374612 L 67.295312,14.808524 C 67.4175,14.04485 67.112031,13.311724 66.470545,12.85352 Z M 56.023496,58.643364 40.994408,52.503431 55.595839,28.157531 29.233841,47.677017 18.970074,43.492088 62.774367,18.229779 56.023496,58.643364 Z" |
|||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:FontAwesome;-inkscape-font-specification:FontAwesome;fill:#ffffff" |
|||
id="path3342" /> |
|||
</g> |
|||
</svg> |
@ -0,0 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from . import test_mass_mailing_resend |
@ -0,0 +1,36 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2017 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': 'mail.mass_mailing.contact', |
|||
'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') |
@ -0,0 +1,28 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<record model="ir.ui.view" id="view_mail_mass_mailing_form"> |
|||
<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="state" position="before"> |
|||
<button string="Resend" |
|||
states="done" |
|||
name="button_draft" |
|||
type="object" |
|||
/> |
|||
</field> |
|||
<header position="after"> |
|||
<div class="alert alert-warning oe_text_center" attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('sent', '=', 0)]}"> |
|||
<p> |
|||
<i class="fa fa-info-circle"/> 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 <b>Emails Sent</b> smart-button for removing the existing record(s). |
|||
</p> |
|||
</div> |
|||
</header> |
|||
<div name="button_box" position="attributes"> |
|||
<attribute name="attrs">{'invisible': [('sent', '=', 0)]}</attribute> |
|||
</div> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue