David
7 years ago
27 changed files with 181 additions and 198 deletions
-
97mass_mailing_custom_unsubscribe/README.rst
-
3mass_mailing_custom_unsubscribe/__init__.py
-
14mass_mailing_custom_unsubscribe/__manifest__.py
-
1mass_mailing_custom_unsubscribe/controllers/__init__.py
-
27mass_mailing_custom_unsubscribe/controllers/main.py
-
3mass_mailing_custom_unsubscribe/exceptions.py
-
17mass_mailing_custom_unsubscribe/hooks.py
-
3mass_mailing_custom_unsubscribe/models/__init__.py
-
14mass_mailing_custom_unsubscribe/models/mail_mail.py
-
41mass_mailing_custom_unsubscribe/models/mail_mass_mailing.py
-
30mass_mailing_custom_unsubscribe/models/mail_mass_mailing_contact.py
-
3mass_mailing_custom_unsubscribe/models/mail_mass_mailing_list.py
-
25mass_mailing_custom_unsubscribe/models/mail_unsubscription.py
-
10mass_mailing_custom_unsubscribe/readme/CONFIGURE.rst
-
4mass_mailing_custom_unsubscribe/readme/CONTRIBUTORS.rst
-
8mass_mailing_custom_unsubscribe/readme/DESCRIPTION.rst
-
11mass_mailing_custom_unsubscribe/readme/ROADMAP.rst
-
8mass_mailing_custom_unsubscribe/readme/USAGE.rst
-
2mass_mailing_custom_unsubscribe/static/src/js/partner.tour.js
-
2mass_mailing_custom_unsubscribe/static/src/js/require_details.js
-
4mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js
-
2mass_mailing_custom_unsubscribe/templates/mass_mailing_contact_reason.xml
-
1mass_mailing_custom_unsubscribe/tests/__init__.py
-
10mass_mailing_custom_unsubscribe/tests/test_ui.py
-
3mass_mailing_custom_unsubscribe/tests/test_unsubscription.py
-
30mass_mailing_custom_unsubscribe/views/mail_mass_mailing_contact_view.xml
-
4mass_mailing_custom_unsubscribe/views/mail_unsubscription_view.xml
@ -1,96 +1 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
========================================================== |
|||
Customizable unsubscription process on mass mailing emails |
|||
========================================================== |
|||
|
|||
This addon extends the unsubscription form to let you: |
|||
|
|||
- Choose which mailing lists are not cross-unsubscriptable when unsubscribing |
|||
from a different one. |
|||
- Know why and when a contact has been subscribed or unsubscribed from a |
|||
mass mailing. |
|||
- Provide proof on why you are sending mass mailings to a given contact, as |
|||
required by the GDPR in Europe. |
|||
|
|||
Configuration |
|||
============= |
|||
|
|||
Unsubscription Reasons |
|||
---------------------- |
|||
|
|||
You can customize what reasons will be displayed to your unsubscriptors when |
|||
they are going to unsubscribe. To do it: |
|||
|
|||
#. Go to *Mass Mailing > Configuration > Unsubscription Reasons*. |
|||
#. Create / edit / remove / sort as usual. |
|||
#. If *Details required* is enabled, they will have to fill a text area to |
|||
continue. |
|||
|
|||
Usage |
|||
===== |
|||
|
|||
Once configured: |
|||
|
|||
#. Go to *Mass Mailing > Mailings > Mass Mailings > Create*. |
|||
#. Edit your mass mailing at wish, but remember to add a snippet from |
|||
*Footers*, so people have an *Unsubscribe* link. |
|||
#. Send it. |
|||
#. If somebody gets unsubscribed, you will see logs about that under |
|||
*Mass Mailing > Mailings > Unsubscriptions*. |
|||
|
|||
.. 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/10.0 |
|||
|
|||
Known issues / Roadmap |
|||
====================== |
|||
|
|||
* This module adds a security hash for mass mailing unsubscription URLs, which |
|||
disables insecure URLs from mass mailing messages sent before its |
|||
installation. This can be a problem, but anyway you'd get that problem in |
|||
Odoo 11.0, where https://github.com/odoo/odoo/pull/12040 was merged, so at |
|||
least this addon will be forward-compatible with it. So, **this feature must |
|||
be removed from here when migrating to v11**. |
|||
* This module replaces AJAX submission core implementation from the mailing |
|||
list management form, because it is impossible to extend it. When |
|||
https://github.com/odoo/odoo/pull/14386 gets merged (which upstreams most |
|||
needed changes), this addon will need a refactoring (mostly removing |
|||
duplicated functionality and depending on it instead of replacing it). In the |
|||
mean time, there is a little chance that this introduces some |
|||
incompatibilities with other addons that depend on ``website_mass_mailing``. |
|||
|
|||
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. |
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Rafael Blasco <rafael.blasco@tecnativa.com> |
|||
* Antonio Espinosa <antonio.espinosa@tecnativa.com> |
|||
* Jairo Llopis <jairo.llopis@tecnativa.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 https://odoo-community.org. |
|||
**This file is going to be generated by oca-gen-addon-readme.** |
@ -1,5 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from . import controllers, models |
|||
from .hooks import post_init_hook |
@ -1,4 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
|
@ -0,0 +1,17 @@ |
|||
# Copyright 2018 David Vidal <david.vidal@tecnativa.com> |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
|||
|
|||
from odoo import api, SUPERUSER_ID |
|||
|
|||
|
|||
def post_init_hook(cr, registry): |
|||
"""Ensure all existing contacts are going to work as v10""" |
|||
env = api.Environment(cr, SUPERUSER_ID, {}) |
|||
contacts = env['mail.mass_mailing.contact'].search([]) |
|||
for contact in contacts: |
|||
if len(contact.list_ids) <= 1: |
|||
continue |
|||
list_1 = contact.list_ids[0] |
|||
for list_ in contact.list_ids - list_1: |
|||
contact.copy({"list_ids": [(6, 0, list_.ids)]}) |
|||
contact.list_ids = list_1 |
@ -1,7 +1,6 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from . import mail_mail |
|||
from . import mail_mass_mailing |
|||
from . import mail_mass_mailing_contact |
|||
from . import mail_mass_mailing_list |
|||
from . import mail_unsubscription |
@ -1,14 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from openerp import models |
|||
|
|||
|
|||
class MailMail(models.Model): |
|||
_inherit = 'mail.mail' |
|||
|
|||
def _get_unsubscribe_url(self, email_to): |
|||
result = super(MailMail, self)._get_unsubscribe_url(email_to) |
|||
token = self.mailing_id._unsubscribe_token(self.res_id) |
|||
return "%s&token=%s" % (result, token) |
@ -0,0 +1,30 @@ |
|||
# Copyright 2018 David Vidal <david.vidal@tecnativa.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class MailMassMailing(models.Model): |
|||
_inherit = "mail.mass_mailing.contact" |
|||
|
|||
# Recover the old Many2one field so we can set a contact by list |
|||
mailing_list_id = fields.Many2one( |
|||
'mail.mass_mailing.list', |
|||
string='Mailing List', |
|||
ondelete='cascade', |
|||
compute="_compute_mailing_list_id", |
|||
inverse="_inverse_mailing_list_id", |
|||
search="_search_mailing_list_id", |
|||
) |
|||
|
|||
@api.depends('list_ids') |
|||
def _compute_mailing_list_id(self): |
|||
for contact in self: |
|||
contact.mailing_list_id = contact.list_ids[:1] |
|||
|
|||
def _inverse_mailing_list_id(self): |
|||
for contact in self: |
|||
contact.list_ids = contact.mailing_list_id |
|||
|
|||
def _search_mailing_list_id(self, operator, value): |
|||
return [('list_ids', operator, value)] |
@ -0,0 +1,10 @@ |
|||
Unsubscription Reasons |
|||
---------------------- |
|||
|
|||
You can customize what reasons will be displayed to your unsubscriptors when |
|||
they are going to unsubscribe. To do it: |
|||
|
|||
#. Go to *Mass Mailing > Configuration > Unsubscription Reasons*. |
|||
#. Create / edit / remove / sort as usual. |
|||
#. If *Details required* is enabled, they will have to fill a text area to |
|||
continue. |
@ -0,0 +1,4 @@ |
|||
* Rafael Blasco <rafael.blasco@tecnativa.com> |
|||
* Antonio Espinosa <antonio.espinosa@tecnativa.com> |
|||
* Jairo Llopis <jairo.llopis@tecnativa.com> |
|||
* David Vidal <david.vidal@tecnativa.com> |
@ -0,0 +1,8 @@ |
|||
This addon extends the unsubscription form to let you: |
|||
|
|||
- Choose which mailing lists are not cross-unsubscriptable when unsubscribing |
|||
from a different one. |
|||
- Know why and when a contact has been subscribed or unsubscribed from a |
|||
mass mailing. |
|||
- Provide proof on why you are sending mass mailings to a given contact, as |
|||
required by the GDPR in Europe. |
@ -0,0 +1,11 @@ |
|||
* As version 11 has introduced a new relation type between mailing lists and |
|||
contacts that has multiple usability issues that are being reworked by Odoo |
|||
to land in version 12, this module falls back to the version 10 behaviour in |
|||
which one contact belonged to just one list. |
|||
* This module replaces AJAX submission core implementation from the mailing |
|||
list management form, because it is impossible to extend it. When |
|||
https://github.com/odoo/odoo/pull/14386 gets merged (which upstreams most |
|||
needed changes), this addon will need a refactoring (mostly removing |
|||
duplicated functionality and depending on it instead of replacing it). In the |
|||
mean time, there is a little chance that this introduces some |
|||
incompatibilities with other addons that depend on ``website_mass_mailing``. |
@ -0,0 +1,8 @@ |
|||
Once configured: |
|||
|
|||
#. Go to *Mass Mailing > Mailings > Mass Mailings > Create*. |
|||
#. Edit your mass mailing at wish, but remember to add a snippet from |
|||
*Footers*, so people have an *Unsubscribe* link. |
|||
#. Send it. |
|||
#. If somebody gets unsubscribed, you will see logs about that under |
|||
*Mass Mailing > Mailings > Unsubscriptions*. |
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Copyright 2018 David Vidal <david.vidal@tecnativa.com> |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|||
|
|||
<odoo> |
|||
|
|||
<record id="view_mail_mass_mailing_contact_form" model="ir.ui.view"> |
|||
<field name="model">mail.mass_mailing.contact</field> |
|||
<field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_contact_form"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="list_ids" position="attributes"> |
|||
<attribute name="invisible">1</attribute> |
|||
</field> |
|||
<field name="email" position="after"> |
|||
<field name="mailing_list_id"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_mail_mass_mailing_contact_tree" model="ir.ui.view"> |
|||
<field name="model">mail.mass_mailing.contact</field> |
|||
<field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_contact_tree"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="email" position="before"> |
|||
<field name="mailing_list_id"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue