diff --git a/mass_mailing_custom_unsubscribe/README.rst b/mass_mailing_custom_unsubscribe/README.rst index 5da443d4b..5b7aec99d 100644 --- a/mass_mailing_custom_unsubscribe/README.rst +++ b/mass_mailing_custom_unsubscribe/README.rst @@ -14,13 +14,13 @@ Customizable unsubscription process on mass mailing emails :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github - :target: https://github.com/OCA/social/tree/14.0/mass_mailing_custom_unsubscribe + :target: https://github.com/OCA/social/tree/15.0/mass_mailing_custom_unsubscribe :alt: OCA/social .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/social-14-0/social-14-0-mass_mailing_custom_unsubscribe + :target: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mass_mailing_custom_unsubscribe :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/205/14.0 + :target: https://runbot.odoo-community.org/runbot/205/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -88,7 +88,7 @@ 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 <https://github.com/OCA/social/issues/new?body=module:%20mass_mailing_custom_unsubscribe%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. +`feedback <https://github.com/OCA/social/issues/new?body=module:%20mass_mailing_custom_unsubscribe%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. Do not contact contributors directly about support or help with technical issues. @@ -126,6 +126,6 @@ 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. -This module is part of the `OCA/social <https://github.com/OCA/social/tree/14.0/mass_mailing_custom_unsubscribe>`_ project on GitHub. +This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.0/mass_mailing_custom_unsubscribe>`_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mass_mailing_custom_unsubscribe/__manifest__.py b/mass_mailing_custom_unsubscribe/__manifest__.py index 729fd29a6..a151bc834 100644 --- a/mass_mailing_custom_unsubscribe/__manifest__.py +++ b/mass_mailing_custom_unsubscribe/__manifest__.py @@ -6,18 +6,30 @@ "name": "Customizable unsubscription process on mass mailing emails", "summary": "Know and track (un)subscription reasons, GDPR compliant", "category": "Marketing", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "depends": ["mass_mailing"], "data": [ "security/ir.model.access.csv", "data/mail_unsubscription_reason.xml", "templates/general_reason_form.xml", "templates/mass_mailing_contact_reason.xml", - "views/assets.xml", "views/mail_unsubscription_reason_view.xml", "views/mail_mass_mailing_list_view.xml", "views/mail_unsubscription_view.xml", ], + "assets": { + "web.assets_backend": [ + ( + "replace", + "mass_mailing/static/src/js/unsubscribe.js", + "mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js", + ), + ], + "web.assets_tests": [ + "mass_mailing_custom_unsubscribe/static/src/js/contact.tour.esm.js", + "mass_mailing_custom_unsubscribe/static/src/js/partner.tour.esm.js", + ], + }, "demo": ["demo/assets.xml"], "images": ["images/form.png"], "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/mass_mailing_custom_unsubscribe/demo/assets.xml b/mass_mailing_custom_unsubscribe/demo/assets.xml index 86743fd88..7830810cd 100644 --- a/mass_mailing_custom_unsubscribe/demo/assets.xml +++ b/mass_mailing_custom_unsubscribe/demo/assets.xml @@ -3,24 +3,18 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> <odoo> -<template id="assets_frontend_demo" inherit_id="web.assets_frontend"> - <xpath expr="."> - <script - type="text/javascript" - src="/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.js" - /> - <script - type="text/javascript" - src="/mass_mailing_custom_unsubscribe/static/src/js/partner.tour.js" - /> - </xpath> -</template> - <!--This is set here to make tours work--> <template id="mass_mailing_custom_unsubscribe.layout" inherit_id="mass_mailing.layout"> <xpath expr="//t[@t-set='head']" position="inside"> - <t t-call-assets="web_editor.assets_wysiwyg" /> - <t t-call-assets="web.assets_frontend" /> + <t t-call-assets="web.assets_common_minimal" t-css="false" defer_load="True" /> + <t + t-call-assets="web.assets_frontend_minimal" + t-css="false" + defer_load="True" + /> + <t t-call="web.conditional_assets_tests" /> + <t t-call-assets="web.assets_common_lazy" t-css="false" lazy_load="True" /> + <t t-call-assets="web.assets_frontend_lazy" t-css="false" lazy_load="True" /> </xpath> </template> diff --git a/mass_mailing_custom_unsubscribe/i18n/mass_mailing_custom_unsubscribe.pot b/mass_mailing_custom_unsubscribe/i18n/mass_mailing_custom_unsubscribe.pot index c9e58c502..df16f422c 100644 --- a/mass_mailing_custom_unsubscribe/i18n/mass_mailing_custom_unsubscribe.pot +++ b/mass_mailing_custom_unsubscribe/i18n/mass_mailing_custom_unsubscribe.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -118,11 +118,8 @@ msgid "Details Required" msgstr "" #. module: mass_mailing_custom_unsubscribe -#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_blacklist__display_name #: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_unsubscription__display_name #: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_unsubscription_reason__display_name -#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mailing_list__display_name -#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mailing_mailing__display_name msgid "Display Name" msgstr "" @@ -142,11 +139,6 @@ msgstr "" msgid "Followers" msgstr "" -#. module: mass_mailing_custom_unsubscribe -#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_unsubscription__message_channel_ids -msgid "Followers (Channels)" -msgstr "" - #. module: mass_mailing_custom_unsubscribe #: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_unsubscription__message_partner_ids msgid "Followers (Partners)" @@ -162,6 +154,11 @@ msgstr "" msgid "HTTP request metadata used when creating this record." msgstr "" +#. module: mass_mailing_custom_unsubscribe +#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_unsubscription__has_message +msgid "Has Message" +msgstr "" + #. module: mass_mailing_custom_unsubscribe #: model:mail.unsubscription.reason,name:mass_mailing_custom_unsubscribe.reason_not_requested msgid "I did not request this" @@ -178,11 +175,8 @@ msgid "I'm not interested" msgstr "" #. module: mass_mailing_custom_unsubscribe -#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_blacklist__id #: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_unsubscription__id #: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_unsubscription_reason__id -#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mailing_list__id -#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mailing_mailing__id msgid "ID" msgstr "" @@ -212,11 +206,8 @@ msgid "Is Follower" msgstr "" #. module: mass_mailing_custom_unsubscribe -#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_blacklist____last_update #: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_unsubscription____last_update #: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mail_unsubscription_reason____last_update -#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mailing_list____last_update -#: model:ir.model.fields,field_description:mass_mailing_custom_unsubscribe.field_mailing_mailing____last_update msgid "Last Modified on" msgstr "" diff --git a/mass_mailing_custom_unsubscribe/models/mail_unsubscription.py b/mass_mailing_custom_unsubscribe/models/mail_unsubscription.py index e1c73679d..9b417dcce 100644 --- a/mass_mailing_custom_unsubscribe/models/mail_unsubscription.py +++ b/mass_mailing_custom_unsubscribe/models/mail_unsubscription.py @@ -3,8 +3,6 @@ from odoo import _, api, fields, models -from odoo.addons.mass_mailing.models.mailing import MASS_MAILING_BUSINESS_MODELS - from .. import exceptions @@ -57,15 +55,6 @@ class MailUnsubscription(models.Model): readonly=True, help="HTTP request metadata used when creating this record." ) - def map_mailing_list_models(self, models): - model_mapped = [] - for model in models: - if model == "mailing.list": - model_mapped.append(("mailing.contact", model)) - else: - model_mapped.append((model, model)) - return model_mapped - @api.model def _default_date(self): return fields.Datetime.now() @@ -73,12 +62,10 @@ class MailUnsubscription(models.Model): @api.model def _selection_unsubscriber_id(self): """Models that can be linked to a ``mailing.mailing``.""" - model = ( - self.env["ir.model"] - .search([("model", "in", MASS_MAILING_BUSINESS_MODELS)]) - .mapped("model") + models = self.env["ir.model"].search( + [("is_mailing_enabled", "=", True), ("model", "!=", "mailing.list")] ) - return self.map_mailing_list_models(model) + return [(model.model, model.name) for model in models] @api.constrains("action", "reason_id") def _check_reason_needed(self): diff --git a/mass_mailing_custom_unsubscribe/static/description/index.html b/mass_mailing_custom_unsubscribe/static/description/index.html index 01c14764e..6caa83b82 100644 --- a/mass_mailing_custom_unsubscribe/static/description/index.html +++ b/mass_mailing_custom_unsubscribe/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/social/tree/14.0/mass_mailing_custom_unsubscribe"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-14-0/social-14-0-mass_mailing_custom_unsubscribe"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> +<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/social/tree/15.0/mass_mailing_custom_unsubscribe"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-15-0/social-15-0-mass_mailing_custom_unsubscribe"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p>This addon extends the unsubscription form to let you:</p> <ul class="simple"> <li>Choose which mailing lists are not cross-unsubscriptable when unsubscribing @@ -440,7 +440,7 @@ duplicated functionality and depending on it instead of replacing it).</li> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>. 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 -<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mass_mailing_custom_unsubscribe%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> +<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mass_mailing_custom_unsubscribe%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <p>Do not contact contributors directly about support or help with technical issues.</p> </div> <div class="section" id="credits"> @@ -473,7 +473,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome <p>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.</p> -<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/14.0/mass_mailing_custom_unsubscribe">OCA/social</a> project on GitHub.</p> +<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/15.0/mass_mailing_custom_unsubscribe">OCA/social</a> project on GitHub.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> </div> </div> diff --git a/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.esm.js b/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.esm.js new file mode 100644 index 000000000..50c27ebee --- /dev/null +++ b/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.esm.js @@ -0,0 +1,90 @@ +/** @odoo-module **/ + +/* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ + +import tour from "web_tour.tour"; + +// Allow to know if an element is required +$.extend($.expr[":"], { + propRequired: (element) => $(element).prop("required"), +}); + +tour.register( + "mass_mailing_custom_unsubscribe_tour_contact", + { + 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 from')", + }, + { + content: "Unsubscription reasons are invisible", + trigger: "#unsubscribe_form:has(#custom_div_feedback:hidden)", + }, + { + content: "List 2 is not cross unsubscriptable", + trigger: "body:not(:has(li:contains('test list 2')))", + }, + { + content: "List 3 is not public", + trigger: "body:not(:has(li:contains('test list 3')))", + }, + { + content: "Uncheck list 1", + trigger: "li:contains('test list 1') input:checked", + }, + { + content: "Choose other reason", + trigger: ".radio:contains('Other reason') :radio", + extra_trigger: ".radio:contains('Other reason') :radio:not(:checked)", + }, + { + content: "Add details to reason", + trigger: "[name='details']:visible:propRequired", + run: "text I want to unsubscribe because I want. Period.", + extra_trigger: ".radio:contains('Other reason') :radio:checked", + }, + { + content: "Update subscriptions 2nd time", + trigger: "#unsubscribe_form :submit", + }, + { + content: "Successfully unsubscribed", + trigger: "#subscription_info:contains('Your changes have been saved.')", + }, + { + content: "Subscribe again to list 0", + trigger: + "body:not(:has(#unsubscribe_form #custom_div_feedback:visible)):has(.alert-success) li:contains('test list 0') input:not(:checked)", + }, + { + content: "Update subscriptions 3nd time", + trigger: + "#unsubscribe_form:not(:has(.js_unsubscription_reason:visible)) :submit", + }, + { + content: "Successfully subscribed", + trigger: "#subscription_info:contains('Your changes have been saved.')", + }, + ] +); diff --git a/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.js b/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.js deleted file mode 100644 index 0642e3624..000000000 --- a/mass_mailing_custom_unsubscribe/static/src/js/contact.tour.js +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> - * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ -odoo.define("mass_mailing_custom_unsubscribe.contact_tour", (require) => { - "use strict"; - const base = require("web_editor.base"); - const tour = require("web_tour.tour"); - - // Allow to know if an element is required - $.extend($.expr[":"], { - propRequired: (element) => $(element).prop("required"), - }); - - tour.register( - "mass_mailing_custom_unsubscribe_tour_contact", - { - 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 from')", - }, - { - content: "Unsubscription reasons are invisible", - trigger: "#unsubscribe_form:has(#custom_div_feedback:hidden)", - }, - { - content: "List 2 is not cross unsubscriptable", - trigger: "body:not(:has(li:contains('test list 2')))", - }, - { - content: "List 3 is not public", - trigger: "body:not(:has(li:contains('test list 3')))", - }, - { - content: "Uncheck list 1", - trigger: "li:contains('test list 1') input:checked", - }, - { - content: "Choose other reason", - trigger: ".radio:contains('Other reason') :radio", - extra_trigger: ".radio:contains('Other reason') :radio:not(:checked)", - }, - { - content: "Add details to reason", - trigger: "[name='details']:visible:propRequired", - run: "text I want to unsubscribe because I want. Period.", - extra_trigger: ".radio:contains('Other reason') :radio:checked", - }, - { - content: "Update subscriptions 2nd time", - trigger: "#unsubscribe_form :submit", - }, - { - content: "Successfully unsubscribed", - trigger: "#subscription_info:contains('Your changes have been saved.')", - }, - { - content: "Subscribe again to list 0", - trigger: - "body:not(:has(#unsubscribe_form #custom_div_feedback:visible)):has(.alert-success) li:contains('test list 0') input:not(:checked)", - }, - { - content: "Update subscriptions 3nd time", - trigger: - "#unsubscribe_form:not(:has(.js_unsubscription_reason:visible)) :submit", - }, - { - content: "Successfully subscribed", - trigger: "#subscription_info:contains('Your changes have been saved.')", - }, - ] - ); -}); diff --git a/mass_mailing_custom_unsubscribe/static/src/js/partner.tour.esm.js b/mass_mailing_custom_unsubscribe/static/src/js/partner.tour.esm.js new file mode 100644 index 000000000..cbd0f3c34 --- /dev/null +++ b/mass_mailing_custom_unsubscribe/static/src/js/partner.tour.esm.js @@ -0,0 +1,41 @@ +/** @odoo-module **/ + +/* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ + +import tour from "web_tour.tour"; + +// Allow to know if an element is required +$.extend($.expr[":"], { + propRequired: (element) => $(element).prop("required"), +}); + +tour.register( + "mass_mailing_custom_unsubscribe_tour_partner", + { + 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/static/src/js/partner.tour.js b/mass_mailing_custom_unsubscribe/static/src/js/partner.tour.js deleted file mode 100644 index e875995fa..000000000 --- a/mass_mailing_custom_unsubscribe/static/src/js/partner.tour.js +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> - * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ -odoo.define("mass_mailing_custom_unsubscribe.partner_tour", (require) => { - "use strict"; - const base = require("web_editor.base"); - const tour = require("web_tour.tour"); - - // Allow to know if an element is required - $.extend($.expr[":"], { - propRequired: (element) => $(element).prop("required"), - }); - - tour.register( - "mass_mailing_custom_unsubscribe_tour_partner", - { - tour: 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/tests/test_ui.py b/mass_mailing_custom_unsubscribe/tests/test_ui.py index 7a73cc0a6..5f413eb7e 100644 --- a/mass_mailing_custom_unsubscribe/tests/test_ui.py +++ b/mass_mailing_custom_unsubscribe/tests/test_ui.py @@ -1,15 +1,13 @@ # Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> # 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 class UICase(HttpCase): - _tour_run = "odoo.__DEBUG__.services['web_tour.tour'].run('%s')" - _tour_ready = "odoo.__DEBUG__.services['web_tour.tour'].tours.%s.ready" - def extract_url(self, mail, *args, **kwargs): url = mail.mailing_id._get_unsubscribe_url(self.email, mail.res_id) self.assertTrue(urls.url_parse(url).decode_query().get("token")) @@ -43,7 +41,7 @@ class UICase(HttpCase): "name": "test mailing %d" % n, "mailing_model_id": self.env.ref("mass_mailing.model_mailing_list").id, "contact_list_ids": [(6, 0, [self.lists[0].id, self.lists[3].id])], - "reply_to_mode": "thread", + "reply_to_mode": "update", "subject": "Test", } ) @@ -73,12 +71,8 @@ class UICase(HttpCase): with self.mail_postprocess_patch: self.mailing.action_send_mail() - tour = "mass_mailing_custom_unsubscribe_tour_contact" - self.browser_js( - url_path=self.url, - code=self._tour_run % tour, - ready=self._tour_ready % tour, - login="demo", + self.start_tour( + self.url, "mass_mailing_custom_unsubscribe_tour_contact", login="admin" ) # Check results from running tour @@ -137,12 +131,8 @@ class UICase(HttpCase): with self.mail_postprocess_patch: self.mailing.action_send_mail() - tour = "mass_mailing_custom_unsubscribe_tour_partner" - self.browser_js( - url_path=self.url, - code=self._tour_run % tour, - ready=self._tour_ready % tour, - login="demo", + self.start_tour( + self.url, "mass_mailing_custom_unsubscribe_tour_partner", login="demo" ) # Check results from running tour diff --git a/mass_mailing_custom_unsubscribe/views/assets.xml b/mass_mailing_custom_unsubscribe/views/assets.xml deleted file mode 100644 index f72bb401a..000000000 --- a/mass_mailing_custom_unsubscribe/views/assets.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com> - License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> -<odoo> - -<template id="assets_backend" inherit_id="mass_mailing.assets_backend"> - <!-- Need to replace the asset because upstream is impossible to extend --> - <xpath - expr="//script[@src='/mass_mailing/static/src/js/unsubscribe.js']" - position="replace" - > - <script - type="text/javascript" - src="/mass_mailing_custom_unsubscribe/static/src/js/unsubscribe.js" - /> - </xpath> -</template> - -</odoo>