[ADD] mass_mailing_custom_unsubscribe addon
This commit is contained in:
parent
0c71daadde
commit
cd1f789155
86
mass_mailing_custom_unsubscribe/README.rst
Normal file
86
mass_mailing_custom_unsubscribe/README.rst
Normal file
@ -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
|
||||
|
||||
<small>You can unsubscribe <a href="%(url)s">here</a></small>
|
||||
|
||||
|
||||
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
|
||||
|
||||
<small>[EN] You can unsubscribe <a href="%(url)s">here</a></small><br/>
|
||||
<small>[ES] Puedes darte de baja <a href="%(url)s">aquí</a></small>
|
||||
|
||||
|
||||
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
|
||||
`here <https://github.com/OCA/social/issues/new?body=module:%20mass_mailing_custom_unsubscribe%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Rafael Blasco <rafabn@antiun.com>
|
||||
* Antonio Espinosa <antonioea@antiun.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 http://odoo-community.org.
|
7
mass_mailing_custom_unsubscribe/__init__.py
Normal file
7
mass_mailing_custom_unsubscribe/__init__.py
Normal file
@ -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
|
37
mass_mailing_custom_unsubscribe/__openerp__.py
Normal file
37
mass_mailing_custom_unsubscribe/__openerp__.py
Normal file
@ -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 <antonioea@antiun.com>
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
{
|
||||
'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,
|
||||
}
|
29
mass_mailing_custom_unsubscribe/i18n/en.po
Normal file
29
mass_mailing_custom_unsubscribe/i18n/en.po
Normal file
@ -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 <transbot@odoo-community.org>\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"
|
29
mass_mailing_custom_unsubscribe/i18n/es.po
Normal file
29
mass_mailing_custom_unsubscribe/i18n/es.po
Normal file
@ -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 <transbot@odoo-community.org>\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"
|
30
mass_mailing_custom_unsubscribe/i18n/pt_BR.po
Normal file
30
mass_mailing_custom_unsubscribe/i18n/pt_BR.po
Normal file
@ -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 <vulcano@uol.com.br>, 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 <vulcano@uol.com.br>\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"
|
30
mass_mailing_custom_unsubscribe/i18n/sl.po
Normal file
30
mass_mailing_custom_unsubscribe/i18n/sl.po
Normal file
@ -0,0 +1,30 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * mass_mailing_custom_unsubscribe
|
||||
#
|
||||
# Translators:
|
||||
# Matjaž Mozetič <m.mozetic@matmoz.si>, 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č <m.mozetic@matmoz.si>\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"
|
7
mass_mailing_custom_unsubscribe/models/__init__.py
Normal file
7
mass_mailing_custom_unsubscribe/models/__init__.py
Normal file
@ -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
|
43
mass_mailing_custom_unsubscribe/models/mail_mail.py
Normal file
43
mass_mailing_custom_unsubscribe/models/mail_mail.py
Normal file
@ -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 = '<small><a href="%(url)s">%(label)s</a></small>' % {
|
||||
'url': url,
|
||||
'label': msg or _('Click to unsubscribe'),
|
||||
}
|
||||
elif config_msg.lower() != 'false':
|
||||
html = config_msg % {
|
||||
'url': url,
|
||||
}
|
||||
return html
|
BIN
mass_mailing_custom_unsubscribe/static/description/icon.png
Normal file
BIN
mass_mailing_custom_unsubscribe/static/description/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
Loading…
x
Reference in New Issue
Block a user