diff --git a/checklog-odoo.cfg b/checklog-odoo.cfg
index 0b55b7b..4864958 100644
--- a/checklog-odoo.cfg
+++ b/checklog-odoo.cfg
@@ -1,3 +1,4 @@
[checklog-odoo]
ignore=
WARNING.* 0 failed, 0 error\(s\).*
+ WARNING .* Killing chrome descendants-or-self .*
diff --git a/mass_mailing_custom_unsubscribe/README.rst b/mass_mailing_custom_unsubscribe/README.rst
index 039b357..c99fe7b 100644
--- a/mass_mailing_custom_unsubscribe/README.rst
+++ b/mass_mailing_custom_unsubscribe/README.rst
@@ -30,13 +30,23 @@ Mass mailing unsubscription metadata
This addon extends the Odoo subscription engine to provide proof on why
you are sending mass mailings to a given contact, as required by the
-GDPR in Europe.
+GDPR in Europe. Also, when you unsubscribe from a specific list, it
+allows you to be redirected to the subscription lists form where the
+reasons for unsubscribing are visible.
**Table of contents**
.. contents::
:local:
+Configuration
+=============
+
+In order to redirect direct unsubscriptions to the Mailing Subscriptions
+form, you need to create the system parameter
+``mass_mailing.mailing_lists_unsubscribe_manager_redirect`` with value
+``1``. Otherwise, the redirect won't happen.
+
Usage
=====
@@ -47,7 +57,10 @@ Once configured:
*Footers*, so people have an *Unsubscribe* link.
3. Send it.
4. If somebody gets unsubscribed, you will see logs about that under
- *Email Marketing > Unsubscriptions*.
+ *Email Marketing > Reporting > Opt-Out report (List view) > Choose
+ one*
+5. Choose a Newsletter with Opt Out, open this record and see Metadata
+ field
Bug Tracker
===========
@@ -82,6 +95,8 @@ Contributors
- Pilar Vargas
- Carlos Lopez
+- Eduardo de Miguel (`Moduon `__)
+
Maintainers
-----------
diff --git a/mass_mailing_custom_unsubscribe/controllers/main.py b/mass_mailing_custom_unsubscribe/controllers/main.py
index 31ea533..3acf9ce 100644
--- a/mass_mailing_custom_unsubscribe/controllers/main.py
+++ b/mass_mailing_custom_unsubscribe/controllers/main.py
@@ -2,13 +2,36 @@
# Copyright 2016 Tecnativa - Jairo Llopis
# Copyright 2020 Tecnativa - Pedro M. Baeza
# Copyright 2024 Tecnativa - David Vidal
+# Copyright 2025 Moduon Team
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.http import request, route
+from odoo.tools.misc import str2bool
from odoo.addons.mass_mailing.controllers.main import MassMailController
class CustomUnsubscribe(MassMailController):
+ @route()
+ def mailing_confirm_unsubscribe(
+ self, mailing_id, document_id=None, email=None, hash_token=None
+ ):
+ """Redirect to the unsubscribe page if the redirect option is enabled."""
+ if str2bool(
+ request.env["ir.config_parameter"]
+ .sudo()
+ .get_param("mass_mailing.mailing_lists_unsubscribe_redirect", "0")
+ ):
+ # Redirect to mailing_unsubscribe() route
+ return request.redirect(
+ request.httprequest.path.replace(
+ "/confirm_unsubscribe", "/unsubscribe"
+ ),
+ code=302,
+ )
+ return super().mailing_confirm_unsubscribe(
+ mailing_id, document_id=document_id, email=email, hash_token=hash_token
+ )
+
def _mailing_unsubscribe_from_list(self, mailing, document_id, email, hash_token):
self._add_metadata()
return super()._mailing_unsubscribe_from_list(
diff --git a/mass_mailing_custom_unsubscribe/readme/CONFIGURE.md b/mass_mailing_custom_unsubscribe/readme/CONFIGURE.md
new file mode 100644
index 0000000..bd023b3
--- /dev/null
+++ b/mass_mailing_custom_unsubscribe/readme/CONFIGURE.md
@@ -0,0 +1,4 @@
+
+In order to redirect direct unsubscriptions to the Mailing Subscriptions form,
+you need to create the system parameter `mass_mailing.mailing_lists_unsubscribe_manager_redirect` with value `1`.
+Otherwise, the redirect won't happen.
diff --git a/mass_mailing_custom_unsubscribe/readme/CONTRIBUTORS.md b/mass_mailing_custom_unsubscribe/readme/CONTRIBUTORS.md
index 814fb07..481f385 100644
--- a/mass_mailing_custom_unsubscribe/readme/CONTRIBUTORS.md
+++ b/mass_mailing_custom_unsubscribe/readme/CONTRIBUTORS.md
@@ -8,3 +8,5 @@
- Carlos Roca
- Pilar Vargas
- Carlos Lopez
+
+- Eduardo de Miguel ([Moduon](https://www.moduon.team/))
diff --git a/mass_mailing_custom_unsubscribe/readme/DESCRIPTION.md b/mass_mailing_custom_unsubscribe/readme/DESCRIPTION.md
index f0f9e4a..8f8836d 100644
--- a/mass_mailing_custom_unsubscribe/readme/DESCRIPTION.md
+++ b/mass_mailing_custom_unsubscribe/readme/DESCRIPTION.md
@@ -1,2 +1,4 @@
This addon extends the Odoo subscription engine to provide proof on why you are sending
mass mailings to a given contact, as required by the GDPR in Europe.
+Also, when you unsubscribe from a specific list, it allows you to be redirected to the
+subscription lists form where the reasons for unsubscribing are visible.
diff --git a/mass_mailing_custom_unsubscribe/readme/USAGE.md b/mass_mailing_custom_unsubscribe/readme/USAGE.md
index cfc8c3a..8763c3c 100644
--- a/mass_mailing_custom_unsubscribe/readme/USAGE.md
+++ b/mass_mailing_custom_unsubscribe/readme/USAGE.md
@@ -5,4 +5,5 @@ Once configured:
*Footers*, so people have an *Unsubscribe* link.
3. Send it.
4. If somebody gets unsubscribed, you will see logs about that under
- *Email Marketing \> Unsubscriptions*.
+ *Email Marketing > Reporting > Opt-Out report (List view) > Choose one*
+5. Choose a Newsletter with Opt Out, open this record and see Metadata field
diff --git a/mass_mailing_custom_unsubscribe/static/description/index.html b/mass_mailing_custom_unsubscribe/static/description/index.html
index a553c9f..516f36c 100644
--- a/mass_mailing_custom_unsubscribe/static/description/index.html
+++ b/mass_mailing_custom_unsubscribe/static/description/index.html
@@ -372,22 +372,32 @@
Mass mailing unsubscription metadata

This addon extends the Odoo subscription engine to provide proof on why
you are sending mass mailings to a given contact, as required by the
-GDPR in Europe.
+GDPR in Europe. Also, when you unsubscribe from a specific list, it
+allows you to be redirected to the subscription lists form where the
+reasons for unsubscribing are visible.
Table of contents
+
+
+
In order to redirect direct unsubscriptions to the Mailing Subscriptions
+form, you need to create the system parameter
+mass_mailing.mailing_lists_unsubscribe_manager_redirect with value
+1. Otherwise, the redirect won’t happen.
+
-
+
Once configured:
- Go to Email Marketing > Mailings > Create.
@@ -395,11 +405,14 @@
Footers, so people have an Unsubscribe link.
- Send it.
- If somebody gets unsubscribed, you will see logs about that under
-Email Marketing > Unsubscriptions.
+Email Marketing > Reporting > Opt-Out report (List view) > Choose
+one
+- Choose a Newsletter with Opt Out, open this record and see Metadata
+field
-
+
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 to smash it by providing a detailed and welcomed
@@ -407,15 +420,15 @@
Do not contact contributors directly about support or help with technical issues.
-
+
-
+
- Tecnativa:
- Rafael Blasco
@@ -429,10 +442,11 @@
- Carlos Lopez
+- Eduardo de Miguel (Moduon)
-
+
This module is maintained by the OCA.
diff --git a/mass_mailing_custom_unsubscribe/tests/test_ui.py b/mass_mailing_custom_unsubscribe/tests/test_ui.py
index 1e17eb0..df6f300 100644
--- a/mass_mailing_custom_unsubscribe/tests/test_ui.py
+++ b/mass_mailing_custom_unsubscribe/tests/test_ui.py
@@ -94,3 +94,25 @@ def test_partner_unsubscription(self):
blacklist = self.env["mail.blacklist"].search([("email", "=", partner.email)])
self.assertEqual(blacklist.opt_out_reason_id.name, "Other")
self.assertTrue("REMOTE_ADDR" in "".join(blacklist.message_ids.mapped("body")))
+
+ def test_mailing_unsubscribe_redirect(self):
+ """Test that /confirm_unsubscribe redirects to /unsubscribe."""
+ # Create parameter to enable redirect
+ self.env["ir.config_parameter"].sudo().set_param(
+ "mass_mailing.mailing_lists_unsubscribe_redirect", "1"
+ )
+ # Change mailing to be sent to partner
+ partner_id = self.env["res.partner"].name_create(
+ f"Demo Partner <{self.email}>"
+ )[0]
+ self.mailing.mailing_model_id = self.env.ref("base.model_res_partner")
+ self.mailing.mailing_domain = repr(
+ [("is_blacklisted", "=", False), ("id", "=", partner_id)]
+ )
+ with self.mail_postprocess_patch:
+ self.mailing.action_send_mail()
+ result = self.url_open(self.url, allow_redirects=False)
+ self.assertTrue(result.ok)
+ self.assertTrue(result.is_redirect)
+ self.assertFalse(result.is_permanent_redirect)
+ self.assertIn("/unsubscribe", result.next.url)