-
-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
19 changed files
with
881 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
=============================== | ||
Welcome mail to new subscribers | ||
=============================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! 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/12.0/mass_mailing_newsletter_welcome_mail | ||
:alt: OCA/social | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/social-12-0/social-12-0-mass_mailing_newsletter_welcome_mail | ||
: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/12.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module was written to extend the functionality of the website popup | ||
newsletter subscription form to support sending to new subscribers an | ||
automatic welcome email and allow you to customize it. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
To configure this module, you need to: | ||
|
||
#. Go to *Email Marketing > Mailing Lists > Mailing Lists*. | ||
#. Edit or create one. | ||
#. Set a *Welcome mail template* to enable this module's special behavior when | ||
somebody subscribes to this mailing list. You can use one shipped with | ||
this module, called *Welcome mail to newsletter subscribers*, | ||
as a starting point. | ||
#. You can also customize this template as you prefer. | ||
|
||
To be used, you also must make sure a subscription snippet for this list exists | ||
somewhere in your website: | ||
|
||
#. Go to your website. | ||
#. Navigate to a page where you want to include the subscription widget. | ||
#. *Edit* the webpage. | ||
#. Drag and drop any *Structure* or *Features* block you like. | ||
#. Drag and drop the *Inner content > Newsletter* block inside it. | ||
#. Choose the same mailing list you configured above. | ||
|
||
Of course, outgoing mail must be properly configured in your instance, or | ||
emails will never be sent. | ||
|
||
Usage | ||
===== | ||
|
||
After you have followed the configuration instructions: | ||
|
||
#. Enter as an anonymous user (you can use a browser private window for that). | ||
#. Navigate to the page where the newsletter subscription snippet is found. | ||
#. Enter your email. | ||
#. Hit *Subscribe*. | ||
#. Check your inbox, you have new mail! | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
* Add tests. | ||
|
||
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 <https://github.com/OCA/social/issues/new?body=module:%20mass_mailing_newsletter_welcome_mail%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Tecnativa | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
|
||
* `Tecnativa <https://www.tecnativa.com>`__: | ||
|
||
* Cristina Martin R. | ||
* Jairo Llopis | ||
* Ernesto Tejeda | ||
|
||
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 <https://github.com/OCA/social/tree/12.0/mass_mailing_newsletter_welcome_mail>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import controllers | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2019 Tecnativa - Cristina Martin R. | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
{ | ||
'name': "Welcome mail to new subscribers", | ||
"summary": "Send an automated welcome mail to new newsletter subscribers", | ||
'license': 'AGPL-3', | ||
'author': 'Tecnativa, ' | ||
'Odoo Community Association (OCA)', | ||
'category': 'Social', | ||
'version': '12.0.1.0.0', | ||
'website': 'https://github.com/OCA/social', | ||
'depends': [ | ||
'website_mass_mailing', | ||
], | ||
'data': [ | ||
"data/mail_template.xml", | ||
"views/mail_mass_mailing_list.xml", | ||
], | ||
'application': False, | ||
'installable': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright 2019 Tecnativa - Jairo Llopis | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo.http import request, route | ||
from odoo.addons.website_mass_mailing.controllers import main | ||
|
||
|
||
class MassMailController(main.MassMailController): | ||
@route() | ||
def subscribe(self, list_id, email, **post): | ||
"""Send welcome email to subscribers.""" | ||
result = super().subscribe(list_id, email, **post) | ||
list_ = request.env["mail.mass_mailing.list"] \ | ||
.sudo().browse(int(list_id)) | ||
template = list_.welcome_mail_template_id | ||
if not template: | ||
return result | ||
# Welcome new subscribers | ||
contact_obj = request.env["mail.mass_mailing.contact"].with_context( | ||
default_list_ids=[list_id]) | ||
contact = contact_obj.sudo().search([ | ||
('email', '=', request.session['mass_mailing_email']), | ||
('opt_out', '=', False), # Needed until odoo/odoo#39604 is fixed | ||
('is_blacklisted', '=', False), | ||
], limit=1) | ||
# Needed until odoo/odoo#39604 is fixed | ||
if not contact: | ||
return result | ||
template.with_context(list_name=list_.name).send_mail( | ||
contact.id, | ||
# Must send now to use context | ||
force_send=True, | ||
# If we cannot notify, the visitor shouldn't be bothered | ||
raise_exception=False, | ||
) | ||
return result |
21 changes: 21 additions & 0 deletions
21
mass_mailing_newsletter_welcome_mail/data/mail_template.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2019 Tecnativa - Jairo Llopis | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
<data noupdate="1"> | ||
|
||
<record id="mail_template_welcome" model="mail.template"> | ||
<field name="name">Welcome mail to newsletter subscribers</field> | ||
<field name="model_id" ref="mass_mailing.model_mail_mass_mailing_contact"/> | ||
<field name="use_default_to" eval="True"/> | ||
<field name="lang">${ctx.get("lang")}</field> | ||
<field name="subject">Welcome to the mailing list ${ctx.get("list_name")}</field> | ||
<field name="body_html" type="html"> | ||
<div>Dear <b>${object.name or object.email}</b>, | ||
<br/> | ||
<h3>Thanks for signing up for our newsletter!</h3> | ||
<p>Regards,</p> | ||
</div> | ||
</field> | ||
</record> | ||
|
||
</data> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mass_mailing_newsletter_welcome_mail | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 11.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2019-05-02 11:06+0000\n" | ||
"PO-Revision-Date: 2019-05-02 12:08+0100\n" | ||
"Last-Translator: Jairo Llopis <yajo.sk8@gmail.com>\n" | ||
"Language-Team: \n" | ||
"Language: es_ES\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"X-Generator: Poedit 2.2.1\n" | ||
|
||
#. module: mass_mailing_newsletter_welcome_mail | ||
#: model:mail.template,body_html:mass_mailing_newsletter_welcome_mail.mail_template_welcome | ||
msgid "" | ||
"<div>Dear <b>${object.name or object.email}</b>,\n" | ||
" <br/>\n" | ||
" <h3>Thanks for signing up for our newsletter!</h3>\n" | ||
" <p>Regards,</p>\n" | ||
" </div>\n" | ||
" " | ||
msgstr "" | ||
"<div>Estimado/a <b>${object.name or object.email}</b>,\n" | ||
" <br/>\n" | ||
" <h3>¡Gracias por suscribirse a nuestro boletín!</h3>\n" | ||
" <p>Saludos,</p>\n" | ||
" </div>\n" | ||
" " | ||
|
||
#. module: mass_mailing_newsletter_welcome_mail | ||
#: model:ir.model.fields,help:mass_mailing_newsletter_welcome_mail.field_mail_mass_mailing_list_welcome_mail_template_id | ||
msgid "Mail template to be sent when a contact is subscribed from the website." | ||
msgstr "" | ||
|
||
#. module: mass_mailing_newsletter_welcome_mail | ||
#: model:ir.model,name:mass_mailing_newsletter_welcome_mail.model_mail_mass_mailing_list | ||
msgid "Mailing List" | ||
msgstr "" | ||
|
||
#. module: mass_mailing_newsletter_welcome_mail | ||
#: model:ir.model.fields,field_description:mass_mailing_newsletter_welcome_mail.field_mail_mass_mailing_list_welcome_mail_template_id | ||
msgid "Welcome mail template" | ||
msgstr "" | ||
|
||
#. module: mass_mailing_newsletter_welcome_mail | ||
#: model:mail.template,subject:mass_mailing_newsletter_welcome_mail.mail_template_welcome | ||
msgid "Welcome to the mailing list ${ctx.get(\"list_name\")}" | ||
msgstr "Bienvenido/a a la lista de correo ${ctx.get(\"list_name\")}" |
45 changes: 45 additions & 0 deletions
45
mass_mailing_newsletter_welcome_mail/i18n/mass_mailing_newsletter_welcome_mail.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mass_mailing_newsletter_welcome_mail | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 11.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_newsletter_welcome_mail | ||
#: model:mail.template,body_html:mass_mailing_newsletter_welcome_mail.mail_template_welcome | ||
msgid "<div>Dear <b>${object.name or object.email}</b>,\n" | ||
" <br/>\n" | ||
" <h3>Thanks for signing up for our newsletter!</h3>\n" | ||
" <p>Regards,</p>\n" | ||
" </div>\n" | ||
" " | ||
msgstr "" | ||
|
||
#. module: mass_mailing_newsletter_welcome_mail | ||
#: model:ir.model.fields,help:mass_mailing_newsletter_welcome_mail.field_mail_mass_mailing_list_welcome_mail_template_id | ||
msgid "Mail template to be sent when a contact is subscribed from the website." | ||
msgstr "" | ||
|
||
#. module: mass_mailing_newsletter_welcome_mail | ||
#: model:ir.model,name:mass_mailing_newsletter_welcome_mail.model_mail_mass_mailing_list | ||
msgid "Mailing List" | ||
msgstr "" | ||
|
||
#. module: mass_mailing_newsletter_welcome_mail | ||
#: model:ir.model.fields,field_description:mass_mailing_newsletter_welcome_mail.field_mail_mass_mailing_list_welcome_mail_template_id | ||
msgid "Welcome mail template" | ||
msgstr "" | ||
|
||
#. module: mass_mailing_newsletter_welcome_mail | ||
#: model:mail.template,subject:mass_mailing_newsletter_welcome_mail.mail_template_welcome | ||
msgid "Welcome to the mailing list ${ctx.get(\"list_name\")}" | ||
msgstr "" | ||
|
31 changes: 31 additions & 0 deletions
31
mass_mailing_newsletter_welcome_mail/i18n/mass_mailing_welcome_mail.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mass_mailing_newsletter_welcome_mail | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 11.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2019-05-02 11:06+0000\n" | ||
"PO-Revision-Date: 2019-05-02 11:06+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_newsletter_welcome_mail | ||
#: model:mail.template,body_html:mass_mailing_newsletter_welcome_mail.email_template | ||
msgid "<div>Dear <b>${object.name or object.email}</b>,\n" | ||
" <br/>\n" | ||
" <h3>Thanks for signing up for our newsletter!</h3>\n" | ||
" <p>Regards,</p>\n" | ||
" </div>\n" | ||
" " | ||
msgstr "" | ||
|
||
#. module: mass_mailing_newsletter_welcome_mail | ||
#: model:mail.template,subject:mass_mailing_newsletter_welcome_mail.email_template | ||
msgid "Welcome to the mailing list ${ctx.get(\"list_name\")}" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import mail_mass_mailing_list |
16 changes: 16 additions & 0 deletions
16
mass_mailing_newsletter_welcome_mail/models/mail_mass_mailing_list.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2019 Tecnativa - Jairo Llopis | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class MailMassMailingList(models.Model): | ||
_inherit = 'mail.mass_mailing.list' | ||
|
||
welcome_mail_template_id = fields.Many2one( | ||
string="Welcome mail template", | ||
comodel_name='mail.template', | ||
ondelete='set null', | ||
help="Mail template to be sent when a contact is subscribed from " | ||
"the website." | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
To configure this module, you need to: | ||
|
||
#. Go to *Email Marketing > Mailing Lists > Mailing Lists*. | ||
#. Edit or create one. | ||
#. Set a *Welcome mail template* to enable this module's special behavior when | ||
somebody subscribes to this mailing list. You can use one shipped with | ||
this module, called *Welcome mail to newsletter subscribers*, | ||
as a starting point. | ||
#. You can also customize this template as you prefer. | ||
|
||
To be used, you also must make sure a subscription snippet for this list exists | ||
somewhere in your website: | ||
|
||
#. Go to your website. | ||
#. Navigate to a page where you want to include the subscription widget. | ||
#. *Edit* the webpage. | ||
#. Drag and drop any *Structure* or *Features* block you like. | ||
#. Drag and drop the *Inner content > Newsletter* block inside it. | ||
#. Choose the same mailing list you configured above. | ||
|
||
Of course, outgoing mail must be properly configured in your instance, or | ||
emails will never be sent. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`__: | ||
|
||
* Cristina Martin R. | ||
* Jairo Llopis | ||
* Ernesto Tejeda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This module was written to extend the functionality of the website popup | ||
newsletter subscription form to support sending to new subscribers an | ||
automatic welcome email and allow you to customize it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Add tests. |
Oops, something went wrong.