[IMP] mail_tracking: black, isort, prettier

This commit is contained in:
Areeb Siddiqi 2021-05-03 12:53:26 -04:00 committed by Jasmin Solanki
parent 5b5a0f04f2
commit c721351a9c
7 changed files with 72 additions and 71 deletions

View File

@ -5,7 +5,7 @@ from odoo import fields, models
class MailBouncedMixin(models.AbstractModel): class MailBouncedMixin(models.AbstractModel):
""" A mixin class to use if you want to add is_bounced flag on a model. """A mixin class to use if you want to add is_bounced flag on a model.
The field '_primary_email' must be overridden in the model that inherit The field '_primary_email' must be overridden in the model that inherit
the mixin and must contain the email field of the model. the mixin and must contain the email field of the model.
""" """

View File

@ -30,7 +30,7 @@ class MailMail(models.Model):
def _send_prepare_values(self, partner=None): def _send_prepare_values(self, partner=None):
"""Creates the mail.tracking.email record and adds the image tracking """Creates the mail.tracking.email record and adds the image tracking
to the email""" to the email"""
email = super()._send_prepare_values(partner=partner) email = super()._send_prepare_values(partner=partner)
vals = self._tracking_email_prepare(partner, email) vals = self._tracking_email_prepare(partner, email)
tracking_email = self.env["mail.tracking.email"].sudo().create(vals) tracking_email = self.env["mail.tracking.email"].sudo().create(vals)

View File

@ -27,7 +27,8 @@ class MailMessage(models.Model):
default=False, default=False,
) )
is_failed_message = fields.Boolean( is_failed_message = fields.Boolean(
compute="_compute_is_failed_message", search="_search_is_failed_message", compute="_compute_is_failed_message",
search="_search_is_failed_message",
) )
@api.model @api.model
@ -258,7 +259,7 @@ class MailMessage(models.Model):
def get_failed_messages(self): def get_failed_messages(self):
"""Returns the list of failed messages to be used by the """Returns the list of failed messages to be used by the
failed_messages widget""" failed_messages widget"""
return [ return [
msg._prepare_dict_failed_message() msg._prepare_dict_failed_message()
for msg in self.sorted("date", reverse=True) for msg in self.sorted("date", reverse=True)
@ -287,9 +288,9 @@ class MailMessage(models.Model):
@api.model @api.model
def set_all_as_reviewed(self): def set_all_as_reviewed(self):
""" Sets all messages in the given domain as reviewed. """Sets all messages in the given domain as reviewed.
Used by Discuss """ Used by Discuss"""
unreviewed_messages = self.search([("is_failed_message", "=", True)]) unreviewed_messages = self.search([("is_failed_message", "=", True)])
unreviewed_messages.write({"mail_tracking_needs_action": False}) unreviewed_messages.write({"mail_tracking_needs_action": False})

View File

@ -22,7 +22,7 @@ class MailThread(models.AbstractModel):
def _get_failed_message_domain(self): def _get_failed_message_domain(self):
"""Domain used to display failed messages on the 'failed_messages' """Domain used to display failed messages on the 'failed_messages'
widget""" widget"""
failed_states = self.env["mail.message"].get_failed_states() failed_states = self.env["mail.message"].get_failed_states()
return [ return [
("mail_tracking_needs_action", "=", True), ("mail_tracking_needs_action", "=", True),

View File

@ -1,6 +1,6 @@
/* Copyright 2019 Alexandre Díaz /* Copyright 2019 Alexandre Díaz
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */
odoo.define("mail_tracking.FailedMessageDiscuss", function(require) { odoo.define("mail_tracking.FailedMessageDiscuss", function (require) {
"use strict"; "use strict";
// To be considered: // To be considered:
@ -28,7 +28,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @returns {Boolean} * @returns {Boolean}
*/ */
isFailed: function() { isFailed: function () {
return false; return false;
}, },
}); });
@ -39,7 +39,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @override * @override
*/ */
init: function(parent, data) { init: function (parent, data) {
this._isFailedMessage = data.is_failed_message; this._isFailedMessage = data.is_failed_message;
return this._super.apply(this, arguments); return this._super.apply(this, arguments);
}, },
@ -50,7 +50,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @override * @override
*/ */
isFailed: function() { isFailed: function () {
return _.contains(this._threadIDs, "mailbox_failed"); return _.contains(this._threadIDs, "mailbox_failed");
}, },
@ -59,7 +59,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @param {Boolean} failed * @param {Boolean} failed
*/ */
setFailed: function(failed) { setFailed: function (failed) {
if (failed) { if (failed) {
this._addThread("mailbox_failed"); this._addThread("mailbox_failed");
} else { } else {
@ -72,7 +72,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @override * @override
*/ */
_processMailboxes: function() { _processMailboxes: function () {
this.setFailed(this._isFailedMessage); this.setFailed(this._isFailedMessage);
return this._super.apply(this, arguments); return this._super.apply(this, arguments);
}, },
@ -84,7 +84,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @override * @override
*/ */
_handlePartnerNotification: function(data) { _handlePartnerNotification: function (data) {
if (data.type === "toggle_tracking_status") { if (data.type === "toggle_tracking_status") {
this._handleChangeTrackingNeedsActionNotification(data); this._handleChangeTrackingNeedsActionNotification(data);
} else { } else {
@ -104,11 +104,11 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* @private * @private
* @param {Object} data * @param {Object} data
*/ */
_handleChangeTrackingNeedsActionNotification: function(data) { _handleChangeTrackingNeedsActionNotification: function (data) {
var self = this; var self = this;
var failed = this.getMailbox("failed"); var failed = this.getMailbox("failed");
_.each(data.message_ids, function(messageID) { _.each(data.message_ids, function (messageID) {
var message = _.find(self._messages, function(msg) { var message = _.find(self._messages, function (msg) {
return msg.getID() === messageID; return msg.getID() === messageID;
}); });
if (message) { if (message) {
@ -149,7 +149,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* @private * @private
* @returns {Object} * @returns {Object}
*/ */
_sidebarQWebParams: function() { _sidebarQWebParams: function () {
var failed = this.call("mail_service", "getMailbox", "failed"); var failed = this.call("mail_service", "getMailbox", "failed");
return { return {
activeThreadID: this._thread ? this._thread.getID() : undefined, activeThreadID: this._thread ? this._thread.getID() : undefined,
@ -163,7 +163,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @override * @override
*/ */
_renderSidebar: function() { _renderSidebar: function () {
var $sidebar = this._super.apply(this, arguments); var $sidebar = this._super.apply(this, arguments);
// Because Odoo implementation isn't designed to be inherited // Because Odoo implementation isn't designed to be inherited
// properly, we inject 'failed' button using jQuery. // properly, we inject 'failed' button using jQuery.
@ -182,7 +182,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @override * @override
*/ */
_renderSidebarMailboxes: function() { _renderSidebarMailboxes: function () {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.$(".o_mail_discuss_sidebar_mailboxes").append( this.$(".o_mail_discuss_sidebar_mailboxes").append(
QWeb.render("mail_tracking.SidebarFailed", this._sidebarQWebParams()) QWeb.render("mail_tracking.SidebarFailed", this._sidebarQWebParams())
@ -194,7 +194,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @override * @override
*/ */
_renderButtons: function() { _renderButtons: function () {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.$btn_set_all_reviewed = this.$buttons.find( this.$btn_set_all_reviewed = this.$buttons.find(
".o_mail_discuss_button_set_all_reviewed" ".o_mail_discuss_button_set_all_reviewed"
@ -212,7 +212,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @override * @override
*/ */
_updateControlPanelButtons: function(thread) { _updateControlPanelButtons: function (thread) {
this.$btn_set_all_reviewed this.$btn_set_all_reviewed
.toggleClass("d-none", thread.getID() !== "mailbox_failed") .toggleClass("d-none", thread.getID() !== "mailbox_failed")
.toggleClass("d-md-inline-block", thread.getID() === "mailbox_failed"); .toggleClass("d-md-inline-block", thread.getID() === "mailbox_failed");
@ -227,7 +227,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @override * @override
*/ */
_updateButtonStatus: function(disabled, type) { _updateButtonStatus: function (disabled, type) {
if (this._thread.getID() === "mailbox_failed") { if (this._thread.getID() === "mailbox_failed") {
this.$btn_set_all_reviewed.toggleClass("disabled", disabled); this.$btn_set_all_reviewed.toggleClass("disabled", disabled);
// Display Rainbowman when all failed messages are reviewed // Display Rainbowman when all failed messages are reviewed
@ -247,15 +247,15 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @override * @override
*/ */
_onMessageUpdated: function(message, type) { _onMessageUpdated: function (message, type) {
var self = this; var self = this;
var currentThreadID = this._thread.getID(); var currentThreadID = this._thread.getID();
if (currentThreadID === "mailbox_failed" && !message.isFailed()) { if (currentThreadID === "mailbox_failed" && !message.isFailed()) {
this._thread.fetchMessages(this.domain).then(function() { this._thread.fetchMessages(this.domain).then(function () {
var options = self._getThreadRenderingOptions(); var options = self._getThreadRenderingOptions();
self._threadWidget self._threadWidget
.removeMessageAndRender(message.getID(), self._thread, options) .removeMessageAndRender(message.getID(), self._thread, options)
.then(function() { .then(function () {
self._updateButtonStatus(!self._thread.hasMessages(), type); self._updateButtonStatus(!self._thread.hasMessages(), type);
}); });
}); });
@ -273,7 +273,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @override * @override
*/ */
_getThreadRenderingOptions: function() { _getThreadRenderingOptions: function () {
var values = this._super.apply(this, arguments); var values = this._super.apply(this, arguments);
if (this._thread.getID() === "mailbox_failed") { if (this._thread.getID() === "mailbox_failed") {
values.displayEmailIcons = true; values.displayEmailIcons = true;
@ -289,7 +289,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @override * @override
*/ */
_startListening: function() { _startListening: function () {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.call("mail_service", "getMailBus").on( this.call("mail_service", "getMailBus").on(
"update_failed", "update_failed",
@ -305,7 +305,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* @private * @private
* @param {Event} event * @param {Event} event
*/ */
_onRetryFailedMessage: function(event) { _onRetryFailedMessage: function (event) {
event.preventDefault(); event.preventDefault();
var messageID = $(event.currentTarget).data("message-id"); var messageID = $(event.currentTarget).data("message-id");
this.do_action("mail.mail_resend_message_action", { this.do_action("mail.mail_resend_message_action", {
@ -322,7 +322,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* @param {Event} event * @param {Event} event
* @returns {Promise} * @returns {Promise}
*/ */
_onMarkFailedMessageReviewed: function(event) { _onMarkFailedMessageReviewed: function (event) {
event.preventDefault(); event.preventDefault();
var messageID = $(event.currentTarget).data("message-id"); var messageID = $(event.currentTarget).data("message-id");
return this._rpc({ return this._rpc({
@ -338,7 +338,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @private * @private
*/ */
_onSetAllAsReviewedClicked: function() { _onSetAllAsReviewedClicked: function () {
var self = this; var self = this;
var failed = this.call("mail_service", "getMailbox", "failed"); var failed = this.call("mail_service", "getMailbox", "failed");
var failed_counter = failed.getMailboxCounter(); var failed_counter = failed.getMailboxCounter();
@ -351,7 +351,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
failed_counter failed_counter
); );
Dialog.confirm(this, promptText, { Dialog.confirm(this, promptText, {
confirm_callback: function() { confirm_callback: function () {
self._thread.setAllMessagesAsReviewed(); self._thread.setAllMessagesAsReviewed();
}, },
}); });
@ -365,7 +365,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @override * @override
*/ */
_updateMailboxesFromServer: function(data) { _updateMailboxesFromServer: function (data) {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this._addMailbox({ this._addMailbox({
id: "failed", id: "failed",
@ -381,7 +381,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* *
* @override * @override
*/ */
_getThreadDomain: function() { _getThreadDomain: function () {
if (this._id === "mailbox_failed") { if (this._id === "mailbox_failed") {
return [["is_failed_message", "=", true]]; return [["is_failed_message", "=", true]];
} }
@ -398,7 +398,7 @@ odoo.define("mail_tracking.FailedMessageDiscuss", function(require) {
* @returns {$.Promise} resolved when all messages have been marked as * @returns {$.Promise} resolved when all messages have been marked as
* reviewed on the server * reviewed on the server
*/ */
setAllMessagesAsReviewed: function() { setAllMessagesAsReviewed: function () {
if (this._id === "mailbox_failed" && this.getMailboxCounter() > 0) { if (this._id === "mailbox_failed" && this.getMailboxCounter() > 0) {
return this._rpc({ return this._rpc({
model: "mail.message", model: "mail.message",

View File

@ -1,6 +1,6 @@
/* Copyright 2019 Alexandre Díaz /* Copyright 2019 Alexandre Díaz
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */
odoo.define("mail_tracking.FailedMessageThread", function(require) { odoo.define("mail_tracking.FailedMessageThread", function (require) {
"use strict"; "use strict";
var AbstractField = require("web.AbstractField"); var AbstractField = require("web.AbstractField");
@ -35,9 +35,9 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
args: [ids], args: [ids],
context: context || widget.getSession().user_context, context: context || widget.getSession().user_context,
}) })
.then(function(messages) { .then(function (messages) {
// Convert date to moment // Convert date to moment
_.each(messages, function(msg) { _.each(messages, function (msg) {
msg.date = moment(time.auto_str_to_date(msg.date)); msg.date = moment(time.auto_str_to_date(msg.date));
msg.hour = utils.timeFromNow(msg.date); msg.hour = utils.timeFromNow(msg.date);
}); });
@ -54,7 +54,7 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* @param {String} fieldName * @param {String} fieldName
* @returns {Array} * @returns {Array}
*/ */
_fetchSpecialFailedMessages: function(record, fieldName) { _fetchSpecialFailedMessages: function (record, fieldName) {
var localID = var localID =
record._changes && fieldName in record._changes record._changes && fieldName in record._changes
? record._changes[fieldName] ? record._changes[fieldName]
@ -76,7 +76,7 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* *
* @override * @override
*/ */
init: function() { init: function () {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.failed_messages = this.record.specialData[this.name] || []; this.failed_messages = this.record.specialData[this.name] || [];
}, },
@ -86,7 +86,7 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* *
* @override * @override
*/ */
start: function() { start: function () {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.call("bus_service", "onNotification", this, this._onNotification); this.call("bus_service", "onNotification", this, this._onNotification);
}, },
@ -97,7 +97,7 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* @private * @private
* @returns {Object} * @returns {Object}
*/ */
_failedItemsQWebParams: function() { _failedItemsQWebParams: function () {
return { return {
failed_messages: this.failed_messages, failed_messages: this.failed_messages,
nbFailedMessages: this.failed_messages.length, nbFailedMessages: this.failed_messages.length,
@ -109,7 +109,7 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
/** /**
* @private * @private
*/ */
_render: function() { _render: function () {
if (this.failed_messages.length) { if (this.failed_messages.length) {
this.$el.html( this.$el.html(
QWeb.render( QWeb.render(
@ -128,7 +128,7 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* @private * @private
* @param {Object} record * @param {Object} record
*/ */
_reset: function(record) { _reset: function (record) {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.failed_messages = this.record.specialData[this.name] || []; this.failed_messages = this.record.specialData[this.name] || [];
this.res_id = record.res_id; this.res_id = record.res_id;
@ -140,7 +140,7 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* @private * @private
* @param {Array} fieldsToReload * @param {Array} fieldsToReload
*/ */
_reload: function(fieldsToReload) { _reload: function (fieldsToReload) {
this.trigger_up("reload_mail_fields", fieldsToReload); this.trigger_up("reload_mail_fields", fieldsToReload);
}, },
@ -151,7 +151,7 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* @param {Int} id * @param {Int} id
* @returns {Promise} * @returns {Promise}
*/ */
_markFailedMessageReviewed: function(id) { _markFailedMessageReviewed: function (id) {
return this._rpc({ return this._rpc({
model: "mail.message", model: "mail.message",
method: "set_need_action_done", method: "set_need_action_done",
@ -169,9 +169,9 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* @private * @private
* @param {Array} notifs * @param {Array} notifs
*/ */
_onNotification: function(notifs) { _onNotification: function (notifs) {
var self = this; var self = this;
_.each(notifs, function(notif) { _.each(notifs, function (notif) {
var model = notif[0][1]; var model = notif[0][1];
if (model === "res.partner") { if (model === "res.partner") {
var data = notif[1]; var data = notif[1];
@ -190,7 +190,7 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* @private * @private
* @param {Event} event * @param {Event} event
*/ */
_onRetryFailedMessage: function(event) { _onRetryFailedMessage: function (event) {
event.preventDefault(); event.preventDefault();
var messageID = $(event.currentTarget).data("message-id"); var messageID = $(event.currentTarget).data("message-id");
this.do_action("mail.mail_resend_message_action", { this.do_action("mail.mail_resend_message_action", {
@ -206,7 +206,7 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* @private * @private
* @param {Event} event * @param {Event} event
*/ */
_onMarkFailedMessageReviewed: function(event) { _onMarkFailedMessageReviewed: function (event) {
event.preventDefault(); event.preventDefault();
var messageID = $(event.currentTarget).data("message-id"); var messageID = $(event.currentTarget).data("message-id");
this._markFailedMessageReviewed(messageID).then( this._markFailedMessageReviewed(messageID).then(
@ -225,7 +225,7 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* *
* @override * @override
*/ */
init: function() { init: function () {
this._super.apply(this, arguments); this._super.apply(this, arguments);
var fieldsInfo = this.fieldsInfo[this.viewType]; var fieldsInfo = this.fieldsInfo[this.viewType];
for (var fieldName in fieldsInfo) { for (var fieldName in fieldsInfo) {
@ -254,7 +254,7 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* *
* @override * @override
*/ */
init: function(parent, record, mailFields, options) { init: function (parent, record, mailFields, options) {
this._super.apply(this, arguments); this._super.apply(this, arguments);
// Initialize mail_failed_message widget // Initialize mail_failed_message widget
if (mailFields.mail_failed_message) { if (mailFields.mail_failed_message) {
@ -273,9 +273,9 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* @private * @private
* @returns {Promise} * @returns {Promise}
*/ */
_render: function() { _render: function () {
var self = this; var self = this;
return this._super.apply(this, arguments).then(function() { return this._super.apply(this, arguments).then(function () {
if (self.fields.failed_message) { if (self.fields.failed_message) {
self.fields.failed_message.$el.insertBefore( self.fields.failed_message.$el.insertBefore(
self.$el.find(".o_mail_thread") self.$el.find(".o_mail_thread")
@ -289,7 +289,7 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* *
* @override * @override
*/ */
_onReloadMailFields: function(event) { _onReloadMailFields: function (event) {
if (this.fields.failed_message && event.data.failed_message) { if (this.fields.failed_message && event.data.failed_message) {
this.trigger_up("reload", { this.trigger_up("reload", {
fieldNames: [this.fields.failed_message.name], fieldNames: [this.fields.failed_message.name],
@ -309,7 +309,7 @@ odoo.define("mail_tracking.FailedMessageThread", function(require) {
* *
* @override * @override
*/ */
init: function() { init: function () {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this._enabledOptions.displayRetryButton = true; this._enabledOptions.displayRetryButton = true;
this._enabledOptions.displayReviewedButton = true; this._enabledOptions.displayReviewedButton = true;

View File

@ -2,7 +2,7 @@
Copyright 2018 David Vidal - <david.vidal@tecnativa.com> Copyright 2018 David Vidal - <david.vidal@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */
odoo.define("mail_tracking.partner_tracking", function(require) { odoo.define("mail_tracking.partner_tracking", function (require) {
"use strict"; "use strict";
var core = require("web.core"); var core = require("web.core");
@ -19,7 +19,7 @@ odoo.define("mail_tracking.partner_tracking", function(require) {
* *
* @returns {Boolean} * @returns {Boolean}
*/ */
hasPartnerTrackings: function() { hasPartnerTrackings: function () {
return false; return false;
}, },
@ -28,13 +28,13 @@ odoo.define("mail_tracking.partner_tracking", function(require) {
* *
* @returns {Boolean} * @returns {Boolean}
*/ */
hasEmailCc: function() { hasEmailCc: function () {
return false; return false;
}, },
}); });
Message.include({ Message.include({
init: function(parent, data) { init: function (parent, data) {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this._partnerTrackings = data.partner_trackings || []; this._partnerTrackings = data.partner_trackings || [];
this._emailCc = data.email_cc || []; this._emailCc = data.email_cc || [];
@ -47,7 +47,7 @@ odoo.define("mail_tracking.partner_tracking", function(require) {
* @override * @override
* @returns {Boolean} * @returns {Boolean}
*/ */
hasPartnerTrackings: function() { hasPartnerTrackings: function () {
return _.some(this._partnerTrackings); return _.some(this._partnerTrackings);
}, },
@ -56,7 +56,7 @@ odoo.define("mail_tracking.partner_tracking", function(require) {
* *
* @returns {Boolean} * @returns {Boolean}
*/ */
hasEmailCc: function() { hasEmailCc: function () {
return _.some(this._emailCc); return _.some(this._emailCc);
}, },
@ -67,7 +67,7 @@ odoo.define("mail_tracking.partner_tracking", function(require) {
* @override * @override
* @returns {Object[]} * @returns {Object[]}
*/ */
getPartnerTrackings: function() { getPartnerTrackings: function () {
if (!this.hasPartnerTrackings()) { if (!this.hasPartnerTrackings()) {
return []; return [];
} }
@ -80,7 +80,7 @@ odoo.define("mail_tracking.partner_tracking", function(require) {
* *
* @returns {Array} * @returns {Array}
*/ */
getEmailCc: function() { getEmailCc: function () {
if (!this.hasEmailCc()) { if (!this.hasEmailCc()) {
return []; return [];
} }
@ -94,16 +94,16 @@ odoo.define("mail_tracking.partner_tracking", function(require) {
* @param {String} email * @param {String} email
* @returns {Boolean} * @returns {Boolean}
*/ */
isEmailCc: function(email) { isEmailCc: function (email) {
if (!this.hasEmailCc()) { if (!this.hasEmailCc()) {
return false; return false;
} }
return _.some(this._emailCc, function(item) { return _.some(this._emailCc, function (item) {
return item[0] === email; return item[0] === email;
}); });
}, },
toggleTrackingStatus: function() { toggleTrackingStatus: function () {
return this._rpc({ return this._rpc({
model: "mail.message", model: "mail.message",
method: "toggle_tracking_status", method: "toggle_tracking_status",
@ -117,7 +117,7 @@ odoo.define("mail_tracking.partner_tracking", function(require) {
"click .o_mail_action_tracking_partner": "on_tracking_partner_click", "click .o_mail_action_tracking_partner": "on_tracking_partner_click",
"click .o_mail_action_tracking_status": "on_tracking_status_click", "click .o_mail_action_tracking_status": "on_tracking_status_click",
}), }),
on_tracking_partner_click: function(event) { on_tracking_partner_click: function (event) {
var partner_id = this.$el.find(event.currentTarget).data("partner"); var partner_id = this.$el.find(event.currentTarget).data("partner");
var state = { var state = {
model: "res.partner", model: "res.partner",
@ -137,7 +137,7 @@ odoo.define("mail_tracking.partner_tracking", function(require) {
}; };
this.do_action(action); this.do_action(action);
}, },
on_tracking_status_click: function(event) { on_tracking_status_click: function (event) {
var tracking_email_id = $(event.currentTarget).data("tracking"); var tracking_email_id = $(event.currentTarget).data("tracking");
var state = { var state = {
model: "mail.tracking.email", model: "mail.tracking.email",
@ -157,9 +157,9 @@ odoo.define("mail_tracking.partner_tracking", function(require) {
}; };
this.do_action(action); this.do_action(action);
}, },
init: function() { init: function () {
this._super.apply(this, arguments); this._super.apply(this, arguments);
this.action_manager = this.findAncestor(function(ancestor) { this.action_manager = this.findAncestor(function (ancestor) {
return ancestor instanceof ActionManager; return ancestor instanceof ActionManager;
}); });
}, },