diff --git a/mass_mailing_custom_unsubscribe_event/__manifest__.py b/mass_mailing_custom_unsubscribe_event/__manifest__.py
index c36e0dd93..3543c8f34 100644
--- a/mass_mailing_custom_unsubscribe_event/__manifest__.py
+++ b/mass_mailing_custom_unsubscribe_event/__manifest__.py
@@ -4,12 +4,16 @@
{
"name": "Allow to unsubscribe discretely from an event",
"category": "Marketing",
- "version": "13.0.1.0.0",
+ "version": "15.0.1.0.0",
"depends": ["event", "mass_mailing_custom_unsubscribe"],
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/social",
"data": ["views/event_registration_views.xml"],
- "demo": ["demo/assets.xml"],
+ "assets": {
+ "web.assets_tests": [
+ "/mass_mailing_custom_unsubscribe_event/static/src/js/tour.esm.js"
+ ]
+ },
"license": "AGPL-3",
"installable": True,
"auto_install": True,
diff --git a/mass_mailing_custom_unsubscribe_event/demo/assets.xml b/mass_mailing_custom_unsubscribe_event/demo/assets.xml
deleted file mode 100644
index c52ea4c61..000000000
--- a/mass_mailing_custom_unsubscribe_event/demo/assets.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mass_mailing_custom_unsubscribe_event/static/src/js/tour.esm.js b/mass_mailing_custom_unsubscribe_event/static/src/js/tour.esm.js
new file mode 100644
index 000000000..0ded979e6
--- /dev/null
+++ b/mass_mailing_custom_unsubscribe_event/static/src/js/tour.esm.js
@@ -0,0 +1,36 @@
+/** @odoo-module **/
+
+/* Copyright 2020 Tecnativa - João Marques
+ * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
+
+import tour from "web_tour.tour";
+
+tour.register(
+ "mass_mailing_custom_unsubscribe_event_tour",
+ {
+ test: true,
+ },
+ [
+ {
+ content: "Choose other reason",
+ trigger: ".radio:contains('Other reason') :radio:not(:checked)",
+ extra_trigger: "#reason_form #custom_div_feedback",
+ },
+ {
+ content: "Switch to not interested reason",
+ trigger: '.radio:contains("I\'m not interested") :radio:not(:checked)',
+ extra_trigger: "[name='details']:propRequired",
+ },
+ {
+ content: "Unsubscribe",
+ trigger: "#reason_form button:submit",
+ extra_trigger: "body:not(:has([name='details']:propRequired))",
+ },
+ {
+ content: "Successfully unsubscribed",
+ trigger:
+ "body:not(:has(#reason_form)) #subscription_info " +
+ ":contains('successfully unsubscribed')",
+ },
+ ]
+);
diff --git a/mass_mailing_custom_unsubscribe_event/static/src/js/tour.js b/mass_mailing_custom_unsubscribe_event/static/src/js/tour.js
deleted file mode 100644
index 7d9cc6d6b..000000000
--- a/mass_mailing_custom_unsubscribe_event/static/src/js/tour.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright 2020 Tecnativa - João Marques
- * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
-odoo.define("mass_mailing_custom_unsubscribe_event.tour", function (require) {
- "use strict";
- var base = require("web_editor.base");
- var tour = require("web_tour.tour");
-
- // Allow to know if an element is required
- $.extend($.expr[":"], {
- propRequired: function (element) {
- return $(element).prop("required");
- },
- });
-
- tour.register(
- "mass_mailing_custom_unsubscribe_event_tour",
- {
- test: true,
- wait_for: base.ready(),
- },
- [
- {
- content: "Choose other reason",
- trigger: ".radio:contains('Other reason') :radio:not(:checked)",
- extra_trigger: "#reason_form #custom_div_feedback",
- },
- {
- content: "Switch to not interested reason",
- trigger: '.radio:contains("I\'m not interested") :radio:not(:checked)',
- extra_trigger: "[name='details']:propRequired",
- },
- {
- content: "Unsubscribe",
- trigger: "#reason_form button:submit",
- extra_trigger: "body:not(:has([name='details']:propRequired))",
- },
- {
- content: "Successfully unsubscribed",
- trigger:
- "body:not(:has(#reason_form)) #subscription_info " +
- ":contains('successfully unsubscribed')",
- },
- ]
- );
-});
diff --git a/mass_mailing_custom_unsubscribe_event/tests/test_ui.py b/mass_mailing_custom_unsubscribe_event/tests/test_ui.py
index 8b62418bd..55c913d10 100644
--- a/mass_mailing_custom_unsubscribe_event/tests/test_ui.py
+++ b/mass_mailing_custom_unsubscribe_event/tests/test_ui.py
@@ -1,21 +1,23 @@
# Copyright 2020 Tecnativa - João Marques
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-import mock
+from unittest import mock
+
from werkzeug import urls
-from odoo.tests.common import HttpCase
+from odoo.tests.common import HttpCase, tagged
+@tagged("post_install", "-at_install")
class UICase(HttpCase):
def extract_url(self, mail, *args, **kwargs):
- url = mail._get_unsubscribe_url(self.email)
+ url = mail.mailing_id._get_unsubscribe_url(self.email, mail.res_id)
self.assertTrue(urls.url_parse(url).decode_query().get("token"))
self.assertTrue(url.startswith(self.domain))
self.url = url.replace(self.domain, "", 1)
return True
def setUp(self):
- super(UICase, self).setUp()
+ super().setUp()
self.email = "test.contact@example.com"
self.mail_postprocess_patch = mock.patch(
"odoo.addons.mass_mailing.models.mail_mail.MailMail."
@@ -23,13 +25,11 @@ class UICase(HttpCase):
autospec=True,
side_effect=self.extract_url,
)
-
self.domain = self.env["ir.config_parameter"].get_param("web.base.url")
self.partner = self.env["res.partner"].create(
{"name": "Demo Partner <%s>" % self.email, "email": self.email}
)
-
self.event_1 = self.env["event.event"].create(
{
"name": "test_event_2",
@@ -62,18 +62,15 @@ class UICase(HttpCase):
"partner_id": self.partner.id,
}
)
-
self.mailing_1 = self.env["mailing.mailing"].create(
{
"name": "test_mailing_1",
"mailing_model_id": self.env.ref("event.model_event_registration").id,
"mailing_domain": "[['id','=',%s]]" % self.event_registration_1.id,
- "reply_to_mode": "email",
+ "reply_to_mode": "update",
"subject": "Test 1",
}
)
- self.mailing_1._onchange_model_and_list()
- # HACK https://github.com/odoo/odoo/pull/14429
self.mailing_1.body_html = """
"""
-
self.mailing_2 = self.env["mailing.mailing"].create(
{
"name": "test_mailing_2",
"mailing_model_id": self.env.ref("event.model_event_registration").id,
"mailing_domain": "[['id','=',%s]]" % self.event_registration_2.id,
- "reply_to_mode": "email",
+ "reply_to_mode": "update",
"subject": "Test 2",
}
)
- self.mailing_2._onchange_model_and_list()
- # HACK https://github.com/odoo/odoo/pull/14429
self.mailing_2.body_html = """