diff --git a/mass_mailing_custom_unsubscribe/README.rst b/mass_mailing_custom_unsubscribe/README.rst new file mode 100644 index 00000000..784b2706 --- /dev/null +++ b/mass_mailing_custom_unsubscribe/README.rst @@ -0,0 +1,86 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +==================================================== +Customizable unsubscribe link on mass mailing emails +==================================================== + +With this module you can set a custom unsubscribe link append at bottom of mass +mailing emails. + + +Configuration +============= + +To configure unsubscribe label go to Setting > Technical > Parameters > System parameters +and add a 'mass_mailing.unsubscribe.label' parameter with html to set at bottom +of mass emailing emails. Including '%(url)s' variable where unsubscribe link + +For example: + +.. code:: html + + You can unsubscribe here + + +Additionally, you can disable this link if you set this parameter to 'False' + +If this parameter (mass_mailing.unsubscribe.label) is not set (or set to '') +default 'Click to unsubscribe' link will appear. This default text is +translatable via Settings > Translations > Application Terms > Translated terms + + +Usage +===== + +.. 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 + + +Known issues / Roadmap +====================== + +* This custom html is not translatable, so as a suggestion, you can define + the same text in several languages in several lines. + +For example: + +.. code:: html + + [EN] You can unsubscribe here
+ [ES] Puedes darte de baja aquí + + +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 +`here `_. + + +Credits +======= + +Contributors +------------ + +* Rafael Blasco +* Antonio Espinosa + +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 http://odoo-community.org. \ No newline at end of file diff --git a/mass_mailing_custom_unsubscribe/__init__.py b/mass_mailing_custom_unsubscribe/__init__.py new file mode 100644 index 00000000..8764d62c --- /dev/null +++ b/mass_mailing_custom_unsubscribe/__init__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# Python source code encoding : https://www.python.org/dev/peps/pep-0263/ +############################################################################## +# For copyright and license notices, see __openerp__.py file in root directory +############################################################################## + +from . import models diff --git a/mass_mailing_custom_unsubscribe/__openerp__.py b/mass_mailing_custom_unsubscribe/__openerp__.py new file mode 100644 index 00000000..bb6854e8 --- /dev/null +++ b/mass_mailing_custom_unsubscribe/__openerp__.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Python source code encoding : https://www.python.org/dev/peps/pep-0263/ +############################################################################## +# +# OpenERP, Odoo Source Management Solution +# Copyright (c) 2015 Antiun Ingeniería S.L. (http://www.antiun.com) +# Antonio Espinosa +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +{ + 'name': "Customizable unsubscribe link on mass mailing emails", + 'category': 'Marketing', + 'version': '8.0.1.0.0', + 'depends': [ + 'mass_mailing', + ], + 'data': [ + ], + 'author': 'Antiun Ingeniería S.L., ' + 'Odoo Community Association (OCA)', + 'website': 'http://www.antiun.com', + 'license': 'AGPL-3', + 'installable': True, +} diff --git a/mass_mailing_custom_unsubscribe/i18n/es.po b/mass_mailing_custom_unsubscribe/i18n/es.po new file mode 100644 index 00000000..3b672ae3 --- /dev/null +++ b/mass_mailing_custom_unsubscribe/i18n/es.po @@ -0,0 +1,28 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mass_mailing_custom_unsubscribe +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-07-06 09:42+0000\n" +"PO-Revision-Date: 2015-07-06 09: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_custom_unsubscribe +#: code:addons/mass_mailing_custom_unsubscribe/models/mail_mail.py:62 +#, python-format +msgid "Click to unsubscribe" +msgstr "Haz click para darte de baja" + +#. module: mass_mailing_custom_unsubscribe +#: model:ir.model,name:mass_mailing_custom_unsubscribe.model_mail_mail +msgid "Outgoing Mails" +msgstr "Correos salientes" + diff --git a/mass_mailing_custom_unsubscribe/models/__init__.py b/mass_mailing_custom_unsubscribe/models/__init__.py new file mode 100644 index 00000000..ac5156be --- /dev/null +++ b/mass_mailing_custom_unsubscribe/models/__init__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# Python source code encoding : https://www.python.org/dev/peps/pep-0263/ +############################################################################## +# For copyright and license notices, see __openerp__.py file in root directory +############################################################################## + +from . import mail_mail diff --git a/mass_mailing_custom_unsubscribe/models/mail_mail.py b/mass_mailing_custom_unsubscribe/models/mail_mail.py new file mode 100644 index 00000000..9ae33586 --- /dev/null +++ b/mass_mailing_custom_unsubscribe/models/mail_mail.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Python source code encoding : https://www.python.org/dev/peps/pep-0263/ +############################################################################## +# For copyright and license notices, see __openerp__.py file in root directory +############################################################################## + +import urlparse +import urllib + +from openerp import models +from openerp.tools.translate import _ + + +class MailMail(models.Model): + _inherit = 'mail.mail' + + def _get_unsubscribe_url(self, cr, uid, mail, email_to, + msg=None, context=None): + m_config = self.pool.get('ir.config_parameter') + base_url = m_config.get_param(cr, uid, 'web.base.url') + config_msg = m_config.get_param(cr, uid, + 'mass_mailing.unsubscribe.label') + url = urlparse.urljoin( + base_url, 'mail/mailing/%(mailing_id)s/unsubscribe?%(params)s' % { + 'mailing_id': mail.mailing_id.id, + 'params': urllib.urlencode({ + 'db': cr.dbname, + 'res_id': mail.res_id, + 'email': email_to + }) + } + ) + html = '' + if config_msg is False: + html = '%(label)s' % { + 'url': url, + 'label': msg or _('Click to unsubscribe'), + } + elif config_msg.lower() != 'false': + html = config_msg % { + 'url': url, + } + return html diff --git a/mass_mailing_custom_unsubscribe/static/description/icon.png b/mass_mailing_custom_unsubscribe/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/mass_mailing_custom_unsubscribe/static/description/icon.png differ