[IMP] pre-commit run -a
This commit is contained in:
parent
8b5f9af06b
commit
5c4b0194f4
@ -1,39 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- © 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="reason_not_interested"
|
||||
model="mail.unsubscription.reason"
|
||||
forcecreate="False">
|
||||
<record
|
||||
id="reason_not_interested"
|
||||
model="mail.unsubscription.reason"
|
||||
forcecreate="False"
|
||||
>
|
||||
<field name="name">I'm not interested</field>
|
||||
<field name="sequence">10</field>
|
||||
<field name="details_required" eval="False"/>
|
||||
<field name="details_required" eval="False" />
|
||||
</record>
|
||||
|
||||
<record id="reason_not_requested"
|
||||
model="mail.unsubscription.reason"
|
||||
forcecreate="False">
|
||||
<record
|
||||
id="reason_not_requested"
|
||||
model="mail.unsubscription.reason"
|
||||
forcecreate="False"
|
||||
>
|
||||
<field name="name">I did not request this</field>
|
||||
<field name="sequence">20</field>
|
||||
<field name="details_required" eval="False"/>
|
||||
<field name="details_required" eval="False" />
|
||||
</record>
|
||||
|
||||
<record id="reason_too_many"
|
||||
model="mail.unsubscription.reason"
|
||||
forcecreate="False">
|
||||
<record id="reason_too_many" model="mail.unsubscription.reason" forcecreate="False">
|
||||
<field name="name">I get too many emails</field>
|
||||
<field name="sequence">30</field>
|
||||
<field name="details_required" eval="False"/>
|
||||
<field name="details_required" eval="False" />
|
||||
</record>
|
||||
|
||||
<record id="reason_other"
|
||||
model="mail.unsubscription.reason"
|
||||
forcecreate="False">
|
||||
<record id="reason_other" model="mail.unsubscription.reason" forcecreate="False">
|
||||
<field name="name">Other reason</field>
|
||||
<field name="sequence">100</field>
|
||||
<field name="details_required" eval="True"/>
|
||||
<field name="details_required" eval="True" />
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
@ -1,25 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?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_frontend_demo"
|
||||
inherit_id="web.assets_frontend">
|
||||
<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"/>
|
||||
<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">
|
||||
<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_editor.assets_wysiwyg" />
|
||||
<t t-call-assets="web.assets_frontend" />
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
@ -1,102 +1,100 @@
|
||||
/* 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",
|
||||
function (require) {
|
||||
"use strict";
|
||||
var base = require("web_editor.base");
|
||||
var tour = require("web_tour.tour");
|
||||
odoo.define("mass_mailing_custom_unsubscribe.contact_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");
|
||||
},
|
||||
});
|
||||
// Allow to know if an element is required
|
||||
$.extend($.expr[":"], {
|
||||
propRequired: function(element) {
|
||||
return $(element).prop("required");
|
||||
},
|
||||
});
|
||||
|
||||
tour.register(
|
||||
"mass_mailing_custom_unsubscribe_tour_contact",
|
||||
tour.register(
|
||||
"mass_mailing_custom_unsubscribe_tour_contact",
|
||||
{
|
||||
test: true,
|
||||
wait_for: base.ready(),
|
||||
},
|
||||
[
|
||||
{
|
||||
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: "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",
|
||||
// eslint-disable-next-line no-multi-str
|
||||
trigger:"body:not(:has(#unsubscribe_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",
|
||||
// eslint-disable-next-line no-multi-str
|
||||
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",
|
||||
// eslint-disable-next-line no-multi-str
|
||||
trigger:"#unsubscribe_form:not(\
|
||||
},
|
||||
{
|
||||
content: "Update subscriptions 3nd time",
|
||||
// eslint-disable-next-line no-multi-str
|
||||
trigger:
|
||||
"#unsubscribe_form:not(\
|
||||
:has(.js_unsubscription_reason:visible)) :submit",
|
||||
},
|
||||
{
|
||||
content: "Successfully subscribed",
|
||||
trigger:
|
||||
"#subscription_info:contains('Your changes have been saved.')",
|
||||
},
|
||||
]
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
{
|
||||
content: "Successfully subscribed",
|
||||
trigger: "#subscription_info:contains('Your changes have been saved.')",
|
||||
},
|
||||
]
|
||||
);
|
||||
});
|
||||
|
@ -1,48 +1,48 @@
|
||||
/* 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",
|
||||
function (require) {
|
||||
"use strict";
|
||||
var base = require("web_editor.base");
|
||||
var tour = require("web_tour.tour");
|
||||
odoo.define("mass_mailing_custom_unsubscribe.partner_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");
|
||||
},
|
||||
});
|
||||
// Allow to know if an element is required
|
||||
$.extend($.expr[":"], {
|
||||
propRequired: function(element) {
|
||||
return $(element).prop("required");
|
||||
},
|
||||
});
|
||||
|
||||
tour.register(
|
||||
"mass_mailing_custom_unsubscribe_tour_partner",
|
||||
tour.register(
|
||||
"mass_mailing_custom_unsubscribe_tour_partner",
|
||||
{
|
||||
tour: true,
|
||||
wait_for: base.ready(),
|
||||
},
|
||||
[
|
||||
{
|
||||
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: "Choose other reason",
|
||||
trigger: ".radio:contains('Other reason') :radio:not(:checked)",
|
||||
extra_trigger: "#reason_form #custom_div_feedback",
|
||||
},
|
||||
{
|
||||
content: "Switch to not interested reason",
|
||||
// eslint-disable-next-line no-multi-str
|
||||
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')",
|
||||
},
|
||||
]
|
||||
);
|
||||
}
|
||||
);
|
||||
{
|
||||
content: "Switch to not interested reason",
|
||||
// eslint-disable-next-line no-multi-str
|
||||
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')",
|
||||
},
|
||||
]
|
||||
);
|
||||
});
|
||||
|
@ -5,30 +5,30 @@
|
||||
* to extend it as it is currently designed. It is almost a copy+paste from
|
||||
* upstream, to allow easier version/patch updates, so linter is disabled. */
|
||||
/* eslint-disable */
|
||||
odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) {
|
||||
'use strict';
|
||||
odoo.define("mass_mailing_custom_unsubscribe.unsubscribe", function(require) {
|
||||
"use strict";
|
||||
|
||||
var ajax = require('web.ajax');
|
||||
var core = require('web.core');
|
||||
require('web.dom_ready');
|
||||
var ajax = require("web.ajax");
|
||||
var core = require("web.core");
|
||||
require("web.dom_ready");
|
||||
|
||||
var _t = core._t;
|
||||
|
||||
if (!$('.o_unsubscribe_form').length) {
|
||||
if (!$(".o_unsubscribe_form").length) {
|
||||
return $.Deferred().reject("DOM doesn't contain '.o_unsubscribe_form'");
|
||||
}
|
||||
|
||||
var email = $("input[name='email']").val();
|
||||
var mailing_id = parseInt($("input[name='mailing_id']").val(), 10);
|
||||
var res_id = parseInt($("input[name='res_id']").val(), 10);
|
||||
var token = (location.search.split('token' + '=')[1] || '').split('&')[0];
|
||||
var token = (location.search.split("token" + "=")[1] || "").split("&")[0];
|
||||
var $mailing_lists = $("input[name='contact_ids']");
|
||||
var $reasons = $("#custom_div_feedback");
|
||||
var $details = $("textarea[name='details']");
|
||||
var $radio = $(":radio");
|
||||
var $info_state = $("#info_state, #custom_div_feedback");
|
||||
|
||||
$radio.on('change click', function (e) {
|
||||
$radio.on("change click", function(e) {
|
||||
$details.prop(
|
||||
"required",
|
||||
$(e.target).is("[data-details-required]") && $(e.target).is(":visible")
|
||||
@ -36,9 +36,9 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) {
|
||||
});
|
||||
|
||||
// Display reasons form only if there are unsubscriptions
|
||||
var toggle_reasons = function () {
|
||||
var toggle_reasons = function() {
|
||||
// Find contacts that were checked and now are unchecked
|
||||
var $disabled = $mailing_lists.filter(function () {
|
||||
var $disabled = $mailing_lists.filter(function() {
|
||||
var $this = $(this);
|
||||
return !$this.prop("checked") && $this.attr("checked");
|
||||
});
|
||||
@ -47,11 +47,12 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) {
|
||||
var $radios = $reasons.find(":radio");
|
||||
if ($reasons.is(":hidden")) {
|
||||
// Uncheck chosen reason
|
||||
$radios.prop("checked", false)
|
||||
// Unrequire specifying a reason
|
||||
.prop("required", false)
|
||||
// Remove possible constraints for details
|
||||
.trigger("change");
|
||||
$radios
|
||||
.prop("checked", false)
|
||||
// Unrequire specifying a reason
|
||||
.prop("required", false)
|
||||
// Remove possible constraints for details
|
||||
.trigger("change");
|
||||
// Clear textarea
|
||||
$details.val("");
|
||||
} else {
|
||||
@ -60,76 +61,87 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) {
|
||||
}
|
||||
};
|
||||
|
||||
$mailing_lists.change(function (e) {
|
||||
$mailing_lists.change(function(e) {
|
||||
toggle_reasons();
|
||||
$('#info_state').addClass('invisible');
|
||||
$("#info_state").addClass("invisible");
|
||||
});
|
||||
|
||||
if (email != '' && email != undefined) {
|
||||
ajax.jsonRpc('/mailing/blacklist/check', 'call', {
|
||||
'email': email,
|
||||
'mailing_id': mailing_id,
|
||||
'res_id': res_id,
|
||||
'token': token
|
||||
if (email != "" && email != undefined) {
|
||||
ajax.jsonRpc("/mailing/blacklist/check", "call", {
|
||||
email: email,
|
||||
mailing_id: mailing_id,
|
||||
res_id: res_id,
|
||||
token: token,
|
||||
})
|
||||
.then(function (result) {
|
||||
if (result == 'unauthorized') {
|
||||
$('#button_add_blacklist').hide();
|
||||
$('#button_remove_blacklist').hide();
|
||||
}
|
||||
else if (result == true) {
|
||||
$('#button_remove_blacklist').show();
|
||||
.then(function(result) {
|
||||
if (result == "unauthorized") {
|
||||
$("#button_add_blacklist").hide();
|
||||
$("#button_remove_blacklist").hide();
|
||||
} else if (result == true) {
|
||||
$("#button_remove_blacklist").show();
|
||||
toggle_opt_out_section(false);
|
||||
}
|
||||
else if (result == false) {
|
||||
$('#button_add_blacklist').show();
|
||||
} else if (result == false) {
|
||||
$("#button_add_blacklist").show();
|
||||
toggle_opt_out_section(true);
|
||||
}
|
||||
else {
|
||||
$('#subscription_info').html(_t('An error occured. Please try again later or contact us.'));
|
||||
$info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error');
|
||||
} else {
|
||||
$("#subscription_info").html(
|
||||
_t("An error occured. Please try again later or contact us.")
|
||||
);
|
||||
$info_state
|
||||
.removeClass("alert-success")
|
||||
.removeClass("alert-info")
|
||||
.removeClass("alert-warning")
|
||||
.addClass("alert-error");
|
||||
}
|
||||
})
|
||||
.guardedCatch(function () {
|
||||
$('#subscription_info').html(_t('An error occured. Please try again later or contact us.'));
|
||||
$info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error');
|
||||
.guardedCatch(function() {
|
||||
$("#subscription_info").html(
|
||||
_t("An error occured. Please try again later or contact us.")
|
||||
);
|
||||
$info_state
|
||||
.removeClass("alert-success")
|
||||
.removeClass("alert-info")
|
||||
.removeClass("alert-warning")
|
||||
.addClass("alert-error");
|
||||
});
|
||||
}
|
||||
else {
|
||||
$('#div_blacklist').hide();
|
||||
} else {
|
||||
$("#div_blacklist").hide();
|
||||
}
|
||||
|
||||
var unsubscribed_list = $("input[name='unsubscribed_list']").val();
|
||||
if (unsubscribed_list){
|
||||
$('#subscription_info').html(_.str.sprintf(
|
||||
_t("You have been <strong>successfully unsubscribed from %s</strong>."),
|
||||
unsubscribed_list
|
||||
));
|
||||
}
|
||||
else{
|
||||
$('#subscription_info').html(_t('You have been <strong>successfully unsubscribed</strong>.'));
|
||||
if (unsubscribed_list) {
|
||||
$("#subscription_info").html(
|
||||
_.str.sprintf(
|
||||
_t("You have been <strong>successfully unsubscribed from %s</strong>."),
|
||||
unsubscribed_list
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$("#subscription_info").html(
|
||||
_t("You have been <strong>successfully unsubscribed</strong>.")
|
||||
);
|
||||
}
|
||||
|
||||
$('#unsubscribe_form').on('submit', function (e) {
|
||||
$("#unsubscribe_form").on("submit", function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var checked_ids = [];
|
||||
$("input[type='checkbox']:checked").each(function (i) {
|
||||
$("input[type='checkbox']:checked").each(function(i) {
|
||||
checked_ids[i] = parseInt($(this).val(), 10);
|
||||
});
|
||||
|
||||
var unchecked_ids = [];
|
||||
$("input[type='checkbox']:not(:checked)").each(function (i) {
|
||||
$("input[type='checkbox']:not(:checked)").each(function(i) {
|
||||
unchecked_ids[i] = parseInt($(this).val(), 10);
|
||||
});
|
||||
|
||||
var values = {
|
||||
'opt_in_ids': checked_ids,
|
||||
'opt_out_ids': unchecked_ids,
|
||||
'email': email,
|
||||
'mailing_id': mailing_id,
|
||||
'res_id': res_id,
|
||||
'token': token
|
||||
opt_in_ids: checked_ids,
|
||||
opt_out_ids: unchecked_ids,
|
||||
email: email,
|
||||
mailing_id: mailing_id,
|
||||
res_id: res_id,
|
||||
token: token,
|
||||
};
|
||||
// Only send reason and details if an unsubscription was found
|
||||
if ($reasons.is(":visible")) {
|
||||
@ -140,41 +152,53 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) {
|
||||
values.details = $details.val();
|
||||
}
|
||||
|
||||
ajax.jsonRpc('/mail/mailing/unsubscribe', 'call', values)
|
||||
.then(function (result) {
|
||||
if (result == 'unauthorized') {
|
||||
$('#info_state').removeClass('invisible');
|
||||
$('#subscription_info').html(_t('You are not authorized to do this!'));
|
||||
$info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-error').addClass('alert-warning');
|
||||
}
|
||||
else if (result == true) {
|
||||
$('#info_state').removeClass('invisible');
|
||||
$('#subscription_info').html(_t('Your changes have been saved.'));
|
||||
$info_state.removeClass('alert-info').addClass('alert-success');
|
||||
ajax.jsonRpc("/mail/mailing/unsubscribe", "call", values)
|
||||
.then(function(result) {
|
||||
if (result == "unauthorized") {
|
||||
$("#info_state").removeClass("invisible");
|
||||
$("#subscription_info").html(
|
||||
_t("You are not authorized to do this!")
|
||||
);
|
||||
$info_state
|
||||
.removeClass("alert-success")
|
||||
.removeClass("alert-info")
|
||||
.removeClass("alert-error")
|
||||
.addClass("alert-warning");
|
||||
} else if (result == true) {
|
||||
$("#info_state").removeClass("invisible");
|
||||
$("#subscription_info").html(_t("Your changes have been saved."));
|
||||
$info_state.removeClass("alert-info").addClass("alert-success");
|
||||
// Store checked status, to enable further changes
|
||||
$mailing_lists.each(function () {
|
||||
$mailing_lists.each(function() {
|
||||
var $this = $(this);
|
||||
$this.attr("checked", $this.prop("checked"));
|
||||
});
|
||||
toggle_reasons();
|
||||
}
|
||||
else {
|
||||
$('#info_state').removeClass('invisible');
|
||||
$('#subscription_info').html(_t('An error occurred. Your changes have not been saved, try again later.'));
|
||||
$info_state.removeClass('alert-info').addClass('alert-warning');
|
||||
} else {
|
||||
$("#info_state").removeClass("invisible");
|
||||
$("#subscription_info").html(
|
||||
_t(
|
||||
"An error occurred. Your changes have not been saved, try again later."
|
||||
)
|
||||
);
|
||||
$info_state.removeClass("alert-info").addClass("alert-warning");
|
||||
}
|
||||
})
|
||||
.guardedCatch(function () {
|
||||
$('#info_state').removeClass('invisible');
|
||||
$('#subscription_info').html(_t('An error occurred. Your changes have not been saved, try again later.'));
|
||||
$info_state.removeClass('alert-info').addClass('alert-warning');
|
||||
.guardedCatch(function() {
|
||||
$("#info_state").removeClass("invisible");
|
||||
$("#subscription_info").html(
|
||||
_t(
|
||||
"An error occurred. Your changes have not been saved, try again later."
|
||||
)
|
||||
);
|
||||
$info_state.removeClass("alert-info").addClass("alert-warning");
|
||||
});
|
||||
});
|
||||
|
||||
// ==================
|
||||
// Blacklist
|
||||
// ==================
|
||||
$('#button_add_blacklist').click(function (e) {
|
||||
$("#button_add_blacklist").click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if ($reasons.is(":hidden")) {
|
||||
@ -185,104 +209,161 @@ odoo.define('mass_mailing_custom_unsubscribe.unsubscribe', function (require) {
|
||||
return;
|
||||
}
|
||||
|
||||
ajax.jsonRpc('/mailing/blacklist/add', 'call', {
|
||||
'email': email,
|
||||
'mailing_id': mailing_id,
|
||||
'res_id': res_id,
|
||||
'token': token,
|
||||
'reason_id': parseInt($reasons.find("[name='reason_id']:checked").val(), 10),
|
||||
'details': $details.val(),
|
||||
ajax.jsonRpc("/mailing/blacklist/add", "call", {
|
||||
email: email,
|
||||
mailing_id: mailing_id,
|
||||
res_id: res_id,
|
||||
token: token,
|
||||
reason_id: parseInt($reasons.find("[name='reason_id']:checked").val(), 10),
|
||||
details: $details.val(),
|
||||
})
|
||||
.then(function (result) {
|
||||
if (result == 'unauthorized') {
|
||||
$('#info_state').removeClass('invisible');
|
||||
$('#subscription_info').html(_t('You are not authorized to do this!'));
|
||||
$info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-error').addClass('alert-warning');
|
||||
}
|
||||
else {
|
||||
.then(function(result) {
|
||||
if (result == "unauthorized") {
|
||||
$("#info_state").removeClass("invisible");
|
||||
$("#subscription_info").html(
|
||||
_t("You are not authorized to do this!")
|
||||
);
|
||||
$info_state
|
||||
.removeClass("alert-success")
|
||||
.removeClass("alert-info")
|
||||
.removeClass("alert-error")
|
||||
.addClass("alert-warning");
|
||||
} else {
|
||||
if (result) {
|
||||
$('#info_state').removeClass('invisible');
|
||||
$('#subscription_info').html(_t('You have been successfully <strong>added to our blacklist</strong>. '
|
||||
+ 'You will not be contacted anymore by our services.'));
|
||||
$info_state.removeClass('alert-warning').removeClass('alert-info').removeClass('alert-error').addClass('alert-success');
|
||||
$("#info_state").removeClass("invisible");
|
||||
$("#subscription_info").html(
|
||||
_t(
|
||||
"You have been successfully <strong>added to our blacklist</strong>. " +
|
||||
"You will not be contacted anymore by our services."
|
||||
)
|
||||
);
|
||||
$info_state
|
||||
.removeClass("alert-warning")
|
||||
.removeClass("alert-info")
|
||||
.removeClass("alert-error")
|
||||
.addClass("alert-success");
|
||||
toggle_opt_out_section(false);
|
||||
// set mailing lists checkboxes to previous state
|
||||
$mailing_lists.each(function () {
|
||||
$mailing_lists.each(function() {
|
||||
var $this = $(this);
|
||||
$this.prop("checked", $(this)[0].hasAttribute("checked"));
|
||||
});
|
||||
// Hide reasons and reset reason fields
|
||||
$reasons.toggleClass("d-none", true)
|
||||
.find(":radio").prop("checked", false);
|
||||
$reasons
|
||||
.toggleClass("d-none", true)
|
||||
.find(":radio")
|
||||
.prop("checked", false);
|
||||
$details.val("").prop("required", false);
|
||||
} else {
|
||||
$("#info_state").removeClass("invisible");
|
||||
$("#subscription_info").html(
|
||||
_t(
|
||||
"An error occured. Please try again later or contact us."
|
||||
)
|
||||
);
|
||||
$info_state
|
||||
.removeClass("alert-success")
|
||||
.removeClass("alert-info")
|
||||
.removeClass("alert-warning")
|
||||
.addClass("alert-error");
|
||||
}
|
||||
else {
|
||||
$('#info_state').removeClass('invisible');
|
||||
$('#subscription_info').html(_t('An error occured. Please try again later or contact us.'));
|
||||
$info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error');
|
||||
}
|
||||
$('#button_add_blacklist').hide();
|
||||
$('#button_remove_blacklist').show();
|
||||
$('#unsubscribed_info').hide();
|
||||
$("#button_add_blacklist").hide();
|
||||
$("#button_remove_blacklist").show();
|
||||
$("#unsubscribed_info").hide();
|
||||
}
|
||||
})
|
||||
.guardedCatch(function () {
|
||||
$('#subscription_info').html(_t('An error occured. Please try again later or contact us.'));
|
||||
$info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error');
|
||||
.guardedCatch(function() {
|
||||
$("#subscription_info").html(
|
||||
_t("An error occured. Please try again later or contact us.")
|
||||
);
|
||||
$info_state
|
||||
.removeClass("alert-success")
|
||||
.removeClass("alert-info")
|
||||
.removeClass("alert-warning")
|
||||
.addClass("alert-error");
|
||||
});
|
||||
});
|
||||
|
||||
$('#button_remove_blacklist').click(function (e) {
|
||||
$("#button_remove_blacklist").click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
ajax.jsonRpc('/mailing/blacklist/remove', 'call', {
|
||||
'email': email,
|
||||
'mailing_id': mailing_id,
|
||||
'res_id': res_id,
|
||||
'token': token
|
||||
ajax.jsonRpc("/mailing/blacklist/remove", "call", {
|
||||
email: email,
|
||||
mailing_id: mailing_id,
|
||||
res_id: res_id,
|
||||
token: token,
|
||||
})
|
||||
.then(function (result) {
|
||||
if (result == 'unauthorized') {
|
||||
$('#info_state').removeClass('invisible');
|
||||
$('#subscription_info').html(_t('You are not authorized to do this!'));
|
||||
$info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-error').addClass('alert-warning');
|
||||
}
|
||||
else {
|
||||
.then(function(result) {
|
||||
if (result == "unauthorized") {
|
||||
$("#info_state").removeClass("invisible");
|
||||
$("#subscription_info").html(
|
||||
_t("You are not authorized to do this!")
|
||||
);
|
||||
$info_state
|
||||
.removeClass("alert-success")
|
||||
.removeClass("alert-info")
|
||||
.removeClass("alert-error")
|
||||
.addClass("alert-warning");
|
||||
} else {
|
||||
if (result) {
|
||||
$('#info_state').removeClass('invisible');
|
||||
$('#subscription_info').html(_t("You have been successfully <strong>removed from our blacklist</strong>. "
|
||||
+ "You are now able to be contacted by our services."));
|
||||
$info_state.removeClass('alert-warning').removeClass('alert-info').removeClass('alert-error').addClass('alert-success');
|
||||
$("#info_state").removeClass("invisible");
|
||||
$("#subscription_info").html(
|
||||
_t(
|
||||
"You have been successfully <strong>removed from our blacklist</strong>. " +
|
||||
"You are now able to be contacted by our services."
|
||||
)
|
||||
);
|
||||
$info_state
|
||||
.removeClass("alert-warning")
|
||||
.removeClass("alert-info")
|
||||
.removeClass("alert-error")
|
||||
.addClass("alert-success");
|
||||
toggle_opt_out_section(true);
|
||||
} else {
|
||||
$("#info_state").removeClass("invisible");
|
||||
$("#subscription_info").html(
|
||||
_t(
|
||||
"An error occured. Please try again later or contact us."
|
||||
)
|
||||
);
|
||||
$info_state
|
||||
.removeClass("alert-success")
|
||||
.removeClass("alert-info")
|
||||
.removeClass("alert-warning")
|
||||
.addClass("alert-error");
|
||||
}
|
||||
else {
|
||||
$('#info_state').removeClass('invisible');
|
||||
$('#subscription_info').html(_t('An error occured. Please try again later or contact us.'));
|
||||
$info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error');
|
||||
}
|
||||
$('#button_add_blacklist').show();
|
||||
$('#button_remove_blacklist').hide();
|
||||
$('#unsubscribed_info').hide();
|
||||
$("#button_add_blacklist").show();
|
||||
$("#button_remove_blacklist").hide();
|
||||
$("#unsubscribed_info").hide();
|
||||
}
|
||||
})
|
||||
.guardedCatch(function () {
|
||||
$('#info_state').removeClass('invisible');
|
||||
$('#subscription_info').html(_t('An error occured. Please try again later or contact us.'));
|
||||
$info_state.removeClass('alert-success').removeClass('alert-info').removeClass('alert-warning').addClass('alert-error');
|
||||
.guardedCatch(function() {
|
||||
$("#info_state").removeClass("invisible");
|
||||
$("#subscription_info").html(
|
||||
_t("An error occured. Please try again later or contact us.")
|
||||
);
|
||||
$info_state
|
||||
.removeClass("alert-success")
|
||||
.removeClass("alert-info")
|
||||
.removeClass("alert-warning")
|
||||
.addClass("alert-error");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function toggle_opt_out_section(value) {
|
||||
var result = !value;
|
||||
$("#div_opt_out").find('*').attr('disabled', result);
|
||||
$("#button_add_blacklist").attr('disabled', false);
|
||||
$("#button_remove_blacklist").attr('disabled', false);
|
||||
$("#custom_div_feedback").find('*').attr('disabled', false);
|
||||
$("#div_opt_out")
|
||||
.find("*")
|
||||
.attr("disabled", result);
|
||||
$("#button_add_blacklist").attr("disabled", false);
|
||||
$("#button_remove_blacklist").attr("disabled", false);
|
||||
$("#custom_div_feedback")
|
||||
.find("*")
|
||||
.attr("disabled", false);
|
||||
if (value) {
|
||||
$('[name="button_subscription"]').addClass('clickable');
|
||||
}
|
||||
else {
|
||||
$('[name="button_subscription"]').removeClass('clickable');
|
||||
$('[name="button_subscription"]').addClass("clickable");
|
||||
} else {
|
||||
$('[name="button_subscription"]').removeClass("clickable");
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,34 @@
|
||||
<?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="reason" name="UI for Providing Unsubscription Reasons">
|
||||
<div id="custom_div_feedback" t-attf-class="alert alert-success mt-4 #{extra_class or ''}" role="status">
|
||||
<p>We would appreciate if you provide feedback about why you updated<br/>your subscriptions
|
||||
<div
|
||||
id="custom_div_feedback"
|
||||
t-attf-class="alert alert-success mt-4 #{extra_class or ''}"
|
||||
role="status"
|
||||
>
|
||||
<p>We would appreciate if you provide feedback about why you updated<br
|
||||
/>your subscriptions
|
||||
</p>
|
||||
<div class="col-md-12 mb16">
|
||||
<t t-foreach="reasons" t-as="reason">
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="reason_id" t-att-data-details-required="reason.details_required" t-att-value="reason.id" required="required"/>
|
||||
<t t-esc="reason.display_name"/>
|
||||
<input
|
||||
type="radio"
|
||||
name="reason_id"
|
||||
t-att-data-details-required="reason.details_required"
|
||||
t-att-value="reason.id"
|
||||
required="required"
|
||||
/>
|
||||
<t t-esc="reason.display_name" />
|
||||
</label>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
<textarea class="form-control" name="details" cols="60" rows="3"></textarea>
|
||||
<textarea class="form-control" name="details" cols="60" rows="3" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -26,12 +36,25 @@
|
||||
<t t-call="mass_mailing.layout">
|
||||
<div class="container o_unsubscribe_form">
|
||||
<div class="row">
|
||||
<form id="reason_form" t-attf-action="/mail/mailing/#{mailing_id}/unsubscribe?token=#{token}" method="post" class="col-lg-6 offset-lg-3 mt-4">
|
||||
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
|
||||
<input type="hidden" name="email" t-att-value="email"/>
|
||||
<input type="hidden" name="mailing_id" t-att-value="mailing_id"/>
|
||||
<input type="hidden" name="res_id" t-att-value="res_id"/>
|
||||
<t t-call="mass_mailing_custom_unsubscribe.reason"/>
|
||||
<form
|
||||
id="reason_form"
|
||||
t-attf-action="/mail/mailing/#{mailing_id}/unsubscribe?token=#{token}"
|
||||
method="post"
|
||||
class="col-lg-6 offset-lg-3 mt-4"
|
||||
>
|
||||
<input
|
||||
type="hidden"
|
||||
name="csrf_token"
|
||||
t-att-value="request.csrf_token()"
|
||||
/>
|
||||
<input type="hidden" name="email" t-att-value="email" />
|
||||
<input
|
||||
type="hidden"
|
||||
name="mailing_id"
|
||||
t-att-value="mailing_id"
|
||||
/>
|
||||
<input type="hidden" name="res_id" t-att-value="res_id" />
|
||||
<t t-call="mass_mailing_custom_unsubscribe.reason" />
|
||||
<div class="form-group mb16 mt16">
|
||||
<button type="submit" class="btn btn-danger">
|
||||
Unsubscribe now
|
||||
|
@ -1,31 +1,36 @@
|
||||
<?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="unsubscribe" inherit_id="mass_mailing.unsubscribe" name="Add Reasons to Mailing List Management Form">
|
||||
<template
|
||||
id="unsubscribe"
|
||||
inherit_id="mass_mailing.unsubscribe"
|
||||
name="Add Reasons to Mailing List Management Form"
|
||||
>
|
||||
<!-- Hide original feedback textarea to put another one after mailing lists checkboxes -->
|
||||
<xpath expr="//div[@id='div_feedback']" position="attributes">
|
||||
<attribute name="class" add="d-none" separator=" "/>
|
||||
<attribute name="class" add="d-none" separator=" " />
|
||||
</xpath>
|
||||
|
||||
<!-- Add reasons to mass mailing list manager -->
|
||||
<xpath expr="//ul[hasclass('list-group')]" position="after">
|
||||
<t t-call="mass_mailing_custom_unsubscribe.reason">
|
||||
<t t-set="extra_class" t-value="'d-none'"/>
|
||||
<t t-set="extra_class" t-value="'d-none'" />
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="unsubscribed"
|
||||
inherit_id="mass_mailing.unsubscribed"
|
||||
name="Add Reasons to Blacklist Management Form">
|
||||
<template
|
||||
id="unsubscribed"
|
||||
inherit_id="mass_mailing.unsubscribed"
|
||||
name="Add Reasons to Blacklist Management Form"
|
||||
>
|
||||
<!-- Add reasons to blacklist manager -->
|
||||
<xpath expr="//div[@id='button_add_blacklist']" position="before">
|
||||
<form id="unsubscribe_form">
|
||||
<t t-call="mass_mailing_custom_unsubscribe.reason">
|
||||
<t t-set="extra_class" t-value="'d-none'"/>
|
||||
<t t-set="extra_class" t-value="'d-none'" />
|
||||
</t>
|
||||
</form>
|
||||
</xpath>
|
||||
|
@ -1,15 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?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">
|
||||
<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
|
||||
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>
|
||||
|
||||
|
@ -1,16 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Copyright 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="view_mail_mass_mailing_list_form" model="ir.ui.view">
|
||||
<field name="model">mailing.list</field>
|
||||
<field name="inherit_id" ref="mass_mailing.mailing_list_view_form"/>
|
||||
<field name="inherit_id" ref="mass_mailing.mailing_list_view_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="is_public" position="after">
|
||||
<field name="not_cross_unsubscriptable"
|
||||
attrs="{'invisible': [('is_public', '=', False)]}"/>
|
||||
<field
|
||||
name="not_cross_unsubscriptable"
|
||||
attrs="{'invisible': [('is_public', '=', False)]}"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?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>
|
||||
|
||||
<record id="mail_unsubscription_reason_view_form" model="ir.ui.view">
|
||||
@ -11,11 +10,11 @@
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="details_required"/>
|
||||
<field name="sequence"/>
|
||||
<field name="name" />
|
||||
<field name="details_required" />
|
||||
<field name="sequence" />
|
||||
</group>
|
||||
<div class="oe_chatter"/>
|
||||
<div class="oe_chatter" />
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
@ -26,9 +25,9 @@
|
||||
<field name="model">mail.unsubscription.reason</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
<field name="details_required"/>
|
||||
<field name="sequence" widget="handle" />
|
||||
<field name="name" />
|
||||
<field name="details_required" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@ -38,20 +37,22 @@
|
||||
<field name="model">mail.unsubscription.reason</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="name"/>
|
||||
<field name="details_required"/>
|
||||
<field name="name" />
|
||||
<field name="details_required" />
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window
|
||||
id="mail_unsubscription_reason_action"
|
||||
name="Unsubscription Reasons"
|
||||
res_model="mail.unsubscription.reason"/>
|
||||
id="mail_unsubscription_reason_action"
|
||||
name="Unsubscription Reasons"
|
||||
res_model="mail.unsubscription.reason"
|
||||
/>
|
||||
|
||||
<menuitem
|
||||
id="mail_unsubscription_reason_menu"
|
||||
parent="mass_mailing.mass_mailing_configuration"
|
||||
action="mail_unsubscription_reason_action"/>
|
||||
id="mail_unsubscription_reason_menu"
|
||||
parent="mass_mailing.mass_mailing_configuration"
|
||||
action="mail_unsubscription_reason_action"
|
||||
/>
|
||||
|
||||
</odoo>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?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>
|
||||
|
||||
<record id="mail_unsubscription_view_form" model="ir.ui.view">
|
||||
@ -11,26 +10,31 @@
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="date"/>
|
||||
<field name="mass_mailing_id"/>
|
||||
<field name="unsubscriber_id"/>
|
||||
<field name="mailing_list_ids" widget="many2many_tags"/>
|
||||
<field name="email"/>
|
||||
<field name="action"/>
|
||||
<field name="reason_id"
|
||||
attrs="{'required': [('action', '=', 'unsubscription')]}"/>
|
||||
<field name="details"
|
||||
attrs="{'required': [('details_required', '=', True)]}"/>
|
||||
<field name="details_required" invisible="True"/>
|
||||
<field name="metadata"/>
|
||||
<field name="date" />
|
||||
<field name="mass_mailing_id" />
|
||||
<field name="unsubscriber_id" />
|
||||
<field name="mailing_list_ids" widget="many2many_tags" />
|
||||
<field name="email" />
|
||||
<field name="action" />
|
||||
<field
|
||||
name="reason_id"
|
||||
attrs="{'required': [('action', '=', 'unsubscription')]}"
|
||||
/>
|
||||
<field
|
||||
name="details"
|
||||
attrs="{'required': [('details_required', '=', True)]}"
|
||||
/>
|
||||
<field name="details_required" invisible="True" />
|
||||
<field name="metadata" />
|
||||
</group>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids"
|
||||
widget="mail_followers"
|
||||
groups="base.group_user"/>
|
||||
<field name="message_ids"
|
||||
widget="mail_thread"/>
|
||||
<field
|
||||
name="message_follower_ids"
|
||||
widget="mail_followers"
|
||||
groups="base.group_user"
|
||||
/>
|
||||
<field name="message_ids" widget="mail_thread" />
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
@ -41,14 +45,14 @@
|
||||
<field name="model">mail.unsubscription</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree decoration-warning="action in ['unsubscription', 'blacklist_add']">
|
||||
<field name="date"/>
|
||||
<field name="mass_mailing_id"/>
|
||||
<field name="unsubscriber_id"/>
|
||||
<field name="mailing_list_ids" widget="many2many_tags"/>
|
||||
<field name="email" invisible="True"/>
|
||||
<field name="action"/>
|
||||
<field name="reason_id"/>
|
||||
<field name="details" invisible="True"/>
|
||||
<field name="date" />
|
||||
<field name="mass_mailing_id" />
|
||||
<field name="unsubscriber_id" />
|
||||
<field name="mailing_list_ids" widget="many2many_tags" />
|
||||
<field name="email" invisible="True" />
|
||||
<field name="action" />
|
||||
<field name="reason_id" />
|
||||
<field name="details" invisible="True" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@ -58,32 +62,44 @@
|
||||
<field name="model">mail.unsubscription</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="mass_mailing_id"/>
|
||||
<field name="unsubscriber_id"/>
|
||||
<field name="mailing_list_ids"/>
|
||||
<field name="email"/>
|
||||
<field name="reason_id"/>
|
||||
<field name="details"/>
|
||||
<separator/>
|
||||
<field name="mass_mailing_id" />
|
||||
<field name="unsubscriber_id" />
|
||||
<field name="mailing_list_ids" />
|
||||
<field name="email" />
|
||||
<field name="reason_id" />
|
||||
<field name="details" />
|
||||
<separator />
|
||||
<group string="Group by">
|
||||
<filter name="group_by_month"
|
||||
<filter
|
||||
name="group_by_month"
|
||||
string="Month"
|
||||
context="{'group_by': 'date:month'}"/>
|
||||
<filter name="group_by_year"
|
||||
context="{'group_by': 'date:month'}"
|
||||
/>
|
||||
<filter
|
||||
name="group_by_year"
|
||||
string="Year"
|
||||
context="{'group_by': 'date:year'}"/>
|
||||
<filter name="group_by_action"
|
||||
context="{'group_by': 'date:year'}"
|
||||
/>
|
||||
<filter
|
||||
name="group_by_action"
|
||||
string="Action"
|
||||
context="{'group_by': 'action'}"/>
|
||||
<filter name="group_by_email"
|
||||
context="{'group_by': 'action'}"
|
||||
/>
|
||||
<filter
|
||||
name="group_by_email"
|
||||
string="Email"
|
||||
context="{'group_by': 'email'}"/>
|
||||
<filter name="group_by_reason"
|
||||
context="{'group_by': 'email'}"
|
||||
/>
|
||||
<filter
|
||||
name="group_by_reason"
|
||||
string="Reason"
|
||||
context="{'group_by': 'reason_id'}"/>
|
||||
<filter name="group_by_mass_mailing"
|
||||
context="{'group_by': 'reason_id'}"
|
||||
/>
|
||||
<filter
|
||||
name="group_by_mass_mailing"
|
||||
string="Mass mailing"
|
||||
context="{'group_by': 'mass_mailing_id'}"/>
|
||||
context="{'group_by': 'mass_mailing_id'}"
|
||||
/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
@ -94,9 +110,9 @@
|
||||
<field name="model">mail.unsubscription</field>
|
||||
<field name="arch" type="xml">
|
||||
<pivot string="(Un)subscriptions">
|
||||
<field name="reason_id" type="row"/>
|
||||
<field name="mailing_list_ids" type="row"/>
|
||||
<field name="action" type="col"/>
|
||||
<field name="reason_id" type="row" />
|
||||
<field name="mailing_list_ids" type="row" />
|
||||
<field name="action" type="col" />
|
||||
</pivot>
|
||||
</field>
|
||||
</record>
|
||||
@ -106,18 +122,23 @@
|
||||
<field name="model">mail.unsubscription</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="(Un)subscriptions">
|
||||
<field name="date" type="row"/>
|
||||
<field name="action" type="col"/>
|
||||
<field name="date" type="row" />
|
||||
<field name="action" type="col" />
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window id="mail_unsubscription_action"
|
||||
name="(Un)subscriptions"
|
||||
view_mode="tree,form,pivot,graph"
|
||||
res_model="mail.unsubscription"/>
|
||||
<act_window
|
||||
id="mail_unsubscription_action"
|
||||
name="(Un)subscriptions"
|
||||
view_mode="tree,form,pivot,graph"
|
||||
res_model="mail.unsubscription"
|
||||
/>
|
||||
|
||||
<menuitem id="mail_unsubscription_menu" parent="mass_mailing.mass_mailing_menu_root"
|
||||
action="mail_unsubscription_action"/>
|
||||
<menuitem
|
||||
id="mail_unsubscription_menu"
|
||||
parent="mass_mailing.mass_mailing_menu_root"
|
||||
action="mail_unsubscription_action"
|
||||
/>
|
||||
|
||||
</odoo>
|
||||
|
Loading…
Reference in New Issue
Block a user