diff --git a/mass_mailing_custom_unsubscribe/README.rst b/mass_mailing_custom_unsubscribe/README.rst new file mode 100644 index 0000000..784b270 --- /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 0000000..8764d62 --- /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 0000000..bb6854e --- /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/en.po b/mass_mailing_custom_unsubscribe/i18n/en.po new file mode 100644 index 0000000..4323ff0 --- /dev/null +++ b/mass_mailing_custom_unsubscribe/i18n/en.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mass_mailing_custom_unsubscribe +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-09-04 14:42+0000\n" +"PO-Revision-Date: 2015-09-04 14:42+0000\n" +"Last-Translator: OCA Transbot \n" +"Language-Team: English (http://www.transifex.com/oca/OCA-social-8-0/language/en/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: en\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mass_mailing_custom_unsubscribe +#: code:addons/mass_mailing_custom_unsubscribe/models/mail_mail.py:37 +#, python-format +msgid "Click to unsubscribe" +msgstr "Click to unsubscribe" + +#. module: mass_mailing_custom_unsubscribe +#: model:ir.model,name:mass_mailing_custom_unsubscribe.model_mail_mail +msgid "Outgoing Mails" +msgstr "Outgoing Mails" diff --git a/mass_mailing_custom_unsubscribe/i18n/es.po b/mass_mailing_custom_unsubscribe/i18n/es.po new file mode 100644 index 0000000..a5a9da5 --- /dev/null +++ b/mass_mailing_custom_unsubscribe/i18n/es.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mass_mailing_custom_unsubscribe +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-09-04 14:42+0000\n" +"PO-Revision-Date: 2015-09-04 14:43+0000\n" +"Last-Translator: OCA Transbot \n" +"Language-Team: Spanish (http://www.transifex.com/oca/OCA-social-8-0/language/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mass_mailing_custom_unsubscribe +#: code:addons/mass_mailing_custom_unsubscribe/models/mail_mail.py:37 +#, 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/i18n/pt_BR.po b/mass_mailing_custom_unsubscribe/i18n/pt_BR.po new file mode 100644 index 0000000..b6201de --- /dev/null +++ b/mass_mailing_custom_unsubscribe/i18n/pt_BR.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mass_mailing_custom_unsubscribe +# +# Translators: +# Armando Vulcano Junior , 2015 +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-09-30 16:56+0000\n" +"PO-Revision-Date: 2015-09-18 19:59+0000\n" +"Last-Translator: Armando Vulcano Junior \n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-social-8-0/language/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: mass_mailing_custom_unsubscribe +#: code:addons/mass_mailing_custom_unsubscribe/models/mail_mail.py:37 +#, python-format +msgid "Click to unsubscribe" +msgstr "Clique para desinscrever" + +#. module: mass_mailing_custom_unsubscribe +#: model:ir.model,name:mass_mailing_custom_unsubscribe.model_mail_mail +msgid "Outgoing Mails" +msgstr "Mails de Saída" diff --git a/mass_mailing_custom_unsubscribe/i18n/sl.po b/mass_mailing_custom_unsubscribe/i18n/sl.po new file mode 100644 index 0000000..0ea6db0 --- /dev/null +++ b/mass_mailing_custom_unsubscribe/i18n/sl.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mass_mailing_custom_unsubscribe +# +# Translators: +# Matjaž Mozetič , 2015 +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-09-04 14:42+0000\n" +"PO-Revision-Date: 2015-09-07 14:25+0000\n" +"Last-Translator: Matjaž Mozetič \n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-social-8-0/language/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"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: mass_mailing_custom_unsubscribe +#: code:addons/mass_mailing_custom_unsubscribe/models/mail_mail.py:37 +#, python-format +msgid "Click to unsubscribe" +msgstr "Klikni za odjavo" + +#. module: mass_mailing_custom_unsubscribe +#: model:ir.model,name:mass_mailing_custom_unsubscribe.model_mail_mail +msgid "Outgoing Mails" +msgstr "Izhodna pošta" diff --git a/mass_mailing_custom_unsubscribe/models/__init__.py b/mass_mailing_custom_unsubscribe/models/__init__.py new file mode 100644 index 0000000..ac5156b --- /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 0000000..9ae3358 --- /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 0000000..3a0328b Binary files /dev/null and b/mass_mailing_custom_unsubscribe/static/description/icon.png differ