Browse Source

[ADD] mass_mailing_custom_unsubscribe addon

pull/279/head
Antonio Espinosa 9 years ago
committed by David
parent
commit
2bc83633ea
  1. 86
      mass_mailing_custom_unsubscribe/README.rst
  2. 7
      mass_mailing_custom_unsubscribe/__init__.py
  3. 37
      mass_mailing_custom_unsubscribe/__openerp__.py
  4. 28
      mass_mailing_custom_unsubscribe/i18n/es.po
  5. 7
      mass_mailing_custom_unsubscribe/models/__init__.py
  6. 43
      mass_mailing_custom_unsubscribe/models/mail_mail.py
  7. BIN
      mass_mailing_custom_unsubscribe/static/description/icon.png

86
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
<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

@ -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

@ -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,
}

28
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"

7
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

43
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 = '<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

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

Loading…
Cancel
Save