[MIG] mass_mailing_custom_unsubscribe: Migration to 15.0
This commit is contained in:
parent
9b7ef0ae19
commit
11ecd1dd9a
@ -14,14 +14,14 @@ Customizable unsubscription process on mass mailing emails
|
|||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
|
.. |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
|
:alt: OCA/social
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |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
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||||
:target: https://runbot.odoo-community.org/runbot/205/14.0
|
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/social&target_branch=15.0
|
||||||
:alt: Try me on Runbot
|
:alt: Try me on Runboat
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ Bug Tracker
|
|||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
|
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.
|
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
|
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.
|
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
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.
|
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.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
@ -6,18 +6,30 @@
|
|||||||
"name": "Customizable unsubscription process on mass mailing emails",
|
"name": "Customizable unsubscription process on mass mailing emails",
|
||||||
"summary": "Know and track (un)subscription reasons, GDPR compliant",
|
"summary": "Know and track (un)subscription reasons, GDPR compliant",
|
||||||
"category": "Marketing",
|
"category": "Marketing",
|
||||||
"version": "14.0.1.0.0",
|
"version": "15.0.1.0.0",
|
||||||
"depends": ["mass_mailing"],
|
"depends": ["mass_mailing"],
|
||||||
"data": [
|
"data": [
|
||||||
"security/ir.model.access.csv",
|
"security/ir.model.access.csv",
|
||||||
"data/mail_unsubscription_reason.xml",
|
"data/mail_unsubscription_reason.xml",
|
||||||
"templates/general_reason_form.xml",
|
"templates/general_reason_form.xml",
|
||||||
"templates/mass_mailing_contact_reason.xml",
|
"templates/mass_mailing_contact_reason.xml",
|
||||||
"views/assets.xml",
|
|
||||||
"views/mail_unsubscription_reason_view.xml",
|
"views/mail_unsubscription_reason_view.xml",
|
||||||
"views/mail_mass_mailing_list_view.xml",
|
"views/mail_mass_mailing_list_view.xml",
|
||||||
"views/mail_unsubscription_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"],
|
"demo": ["demo/assets.xml"],
|
||||||
"images": ["images/form.png"],
|
"images": ["images/form.png"],
|
||||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||||
|
@ -3,24 +3,18 @@
|
|||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||||
<odoo>
|
<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-->
|
<!--This is set here to make tours work-->
|
||||||
<template id="mass_mailing_custom_unsubscribe.layout" inherit_id="mass_mailing.layout">
|
<template id="mass_mailing_custom_unsubscribe.layout" inherit_id="mass_mailing.layout">
|
||||||
<xpath expr="//t[@t-set='head']" position="inside">
|
<xpath expr="//t[@t-set='head']" position="inside">
|
||||||
<t t-call-assets="web_editor.assets_wysiwyg" />
|
<t t-call-assets="web.assets_common_minimal" t-css="false" defer_load="True" />
|
||||||
<t t-call-assets="web.assets_frontend" />
|
<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>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
from odoo import _, api, fields, models
|
from odoo import _, api, fields, models
|
||||||
|
|
||||||
from odoo.addons.mass_mailing.models.mailing import MASS_MAILING_BUSINESS_MODELS
|
|
||||||
|
|
||||||
from .. import exceptions
|
from .. import exceptions
|
||||||
|
|
||||||
|
|
||||||
@ -57,15 +55,6 @@ class MailUnsubscription(models.Model):
|
|||||||
readonly=True, help="HTTP request metadata used when creating this record."
|
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
|
@api.model
|
||||||
def _default_date(self):
|
def _default_date(self):
|
||||||
return fields.Datetime.now()
|
return fields.Datetime.now()
|
||||||
@ -73,12 +62,10 @@ class MailUnsubscription(models.Model):
|
|||||||
@api.model
|
@api.model
|
||||||
def _selection_unsubscriber_id(self):
|
def _selection_unsubscriber_id(self):
|
||||||
"""Models that can be linked to a ``mailing.mailing``."""
|
"""Models that can be linked to a ``mailing.mailing``."""
|
||||||
model = (
|
models = self.env["ir.model"].search(
|
||||||
self.env["ir.model"]
|
[("is_mailing_enabled", "=", True), ("model", "!=", "mailing.list")]
|
||||||
.search([("model", "in", MASS_MAILING_BUSINESS_MODELS)])
|
|
||||||
.mapped("model")
|
|
||||||
)
|
)
|
||||||
return self.map_mailing_list_models(model)
|
return [(model.model, model.name) for model in models]
|
||||||
|
|
||||||
@api.constrains("action", "reason_id")
|
@api.constrains("action", "reason_id")
|
||||||
def _check_reason_needed(self):
|
def _check_reason_needed(self):
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
|
||||||
<title>Customizable unsubscription process on mass mailing emails</title>
|
<title>Customizable unsubscription process on mass mailing emails</title>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ ul.auto-toc {
|
|||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! 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://runboat.odoo-community.org/webui/builds.html?repo=OCA/social&target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||||
<p>This addon extends the unsubscription form to let you:</p>
|
<p>This addon extends the unsubscription form to let you:</p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Choose which mailing lists are not cross-unsubscriptable when unsubscribing
|
<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>.
|
<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.
|
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
|
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>
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="credits">
|
<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
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.</p>
|
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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
@ -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.')",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
);
|
@ -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.')",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
);
|
|
||||||
});
|
|
@ -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')",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
);
|
@ -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')",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
);
|
|
||||||
});
|
|
@ -1,15 +1,13 @@
|
|||||||
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
|
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from werkzeug import urls
|
from werkzeug import urls
|
||||||
|
|
||||||
from odoo.tests.common import HttpCase
|
from odoo.tests.common import HttpCase
|
||||||
|
|
||||||
|
|
||||||
class UICase(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):
|
def extract_url(self, mail, *args, **kwargs):
|
||||||
url = mail.mailing_id._get_unsubscribe_url(self.email, mail.res_id)
|
url = mail.mailing_id._get_unsubscribe_url(self.email, mail.res_id)
|
||||||
self.assertTrue(urls.url_parse(url).decode_query().get("token"))
|
self.assertTrue(urls.url_parse(url).decode_query().get("token"))
|
||||||
@ -43,7 +41,7 @@ class UICase(HttpCase):
|
|||||||
"name": "test mailing %d" % n,
|
"name": "test mailing %d" % n,
|
||||||
"mailing_model_id": self.env.ref("mass_mailing.model_mailing_list").id,
|
"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])],
|
"contact_list_ids": [(6, 0, [self.lists[0].id, self.lists[3].id])],
|
||||||
"reply_to_mode": "thread",
|
"reply_to_mode": "update",
|
||||||
"subject": "Test",
|
"subject": "Test",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -73,12 +71,8 @@ class UICase(HttpCase):
|
|||||||
with self.mail_postprocess_patch:
|
with self.mail_postprocess_patch:
|
||||||
self.mailing.action_send_mail()
|
self.mailing.action_send_mail()
|
||||||
|
|
||||||
tour = "mass_mailing_custom_unsubscribe_tour_contact"
|
self.start_tour(
|
||||||
self.browser_js(
|
self.url, "mass_mailing_custom_unsubscribe_tour_contact", login="admin"
|
||||||
url_path=self.url,
|
|
||||||
code=self._tour_run % tour,
|
|
||||||
ready=self._tour_ready % tour,
|
|
||||||
login="demo",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check results from running tour
|
# Check results from running tour
|
||||||
@ -137,12 +131,8 @@ class UICase(HttpCase):
|
|||||||
with self.mail_postprocess_patch:
|
with self.mail_postprocess_patch:
|
||||||
self.mailing.action_send_mail()
|
self.mailing.action_send_mail()
|
||||||
|
|
||||||
tour = "mass_mailing_custom_unsubscribe_tour_partner"
|
self.start_tour(
|
||||||
self.browser_js(
|
self.url, "mass_mailing_custom_unsubscribe_tour_partner", login="demo"
|
||||||
url_path=self.url,
|
|
||||||
code=self._tour_run % tour,
|
|
||||||
ready=self._tour_ready % tour,
|
|
||||||
login="demo",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check results from running tour
|
# Check results from running tour
|
||||||
|
@ -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>
|
|
@ -0,0 +1 @@
|
|||||||
|
../../../../mass_mailing_custom_unsubscribe
|
6
setup/mass_mailing_custom_unsubscribe/setup.py
Normal file
6
setup/mass_mailing_custom_unsubscribe/setup.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user