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