[IMP] mail_tracking: black, isort, prettier
This commit is contained in:
parent
a4f3acc3cf
commit
021689d073
@ -284,7 +284,7 @@ class MailMessage(models.Model):
|
||||
|
||||
@api.model
|
||||
def get_failed_count(self):
|
||||
""" Gets the number of failed messages used on discuss mailbox item"""
|
||||
"""Gets the number of failed messages used on discuss mailbox item"""
|
||||
return self.search_count([("is_failed_message", "=", True)])
|
||||
|
||||
@api.model
|
||||
|
@ -1,75 +1,76 @@
|
||||
odoo.define("mail_tracking/static/src/js/failed_message/mail_failed_box.js", function (
|
||||
require
|
||||
) {
|
||||
"use strict";
|
||||
odoo.define(
|
||||
"mail_tracking/static/src/js/failed_message/mail_failed_box.js",
|
||||
function (require) {
|
||||
"use strict";
|
||||
|
||||
const chatter = require("mail/static/src/components/chatter/chatter.js");
|
||||
const useStore = require("mail/static/src/component_hooks/use_store/use_store.js");
|
||||
const chatter = require("mail/static/src/components/chatter/chatter.js");
|
||||
const useStore = require("mail/static/src/component_hooks/use_store/use_store.js");
|
||||
|
||||
const {Component} = owl;
|
||||
const {Component} = owl;
|
||||
|
||||
class MessageFailedBox extends Component {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
useStore((props) => {
|
||||
const chatter = this.env.models["mail.chatter"].get(
|
||||
props.chatterLocalId
|
||||
);
|
||||
const thread = chatter && chatter.thread;
|
||||
return {
|
||||
chatter: chatter ? chatter.__state : undefined,
|
||||
thread: thread && thread.__state,
|
||||
};
|
||||
});
|
||||
}
|
||||
class MessageFailedBox extends Component {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
useStore((props) => {
|
||||
const chatter = this.env.models["mail.chatter"].get(
|
||||
props.chatterLocalId
|
||||
);
|
||||
const thread = chatter && chatter.thread;
|
||||
return {
|
||||
chatter: chatter ? chatter.__state : undefined,
|
||||
thread: thread && thread.__state,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
get chatter() {
|
||||
return this.env.models["mail.chatter"].get(this.props.chatterLocalId);
|
||||
}
|
||||
get chatter() {
|
||||
return this.env.models["mail.chatter"].get(this.props.chatterLocalId);
|
||||
}
|
||||
|
||||
_onClickTitle() {
|
||||
this.chatter.toggleMessageFailedBoxVisibility();
|
||||
}
|
||||
_markFailedMessageReviewed(id) {
|
||||
return this.env.services.rpc({
|
||||
model: "mail.message",
|
||||
method: "set_need_action_done",
|
||||
args: [[id]],
|
||||
});
|
||||
}
|
||||
_onRetryFailedMessage(event) {
|
||||
event.preventDefault();
|
||||
var messageID = $(event.currentTarget).data("message-id");
|
||||
const thread = this.chatter.thread;
|
||||
var self = this;
|
||||
this.env.bus.trigger("do-action", {
|
||||
action: "mail.mail_resend_message_action",
|
||||
options: {
|
||||
additional_context: {
|
||||
mail_message_to_resend: messageID,
|
||||
_onClickTitle() {
|
||||
this.chatter.toggleMessageFailedBoxVisibility();
|
||||
}
|
||||
_markFailedMessageReviewed(id) {
|
||||
return this.env.services.rpc({
|
||||
model: "mail.message",
|
||||
method: "set_need_action_done",
|
||||
args: [[id]],
|
||||
});
|
||||
}
|
||||
_onRetryFailedMessage(event) {
|
||||
event.preventDefault();
|
||||
var messageID = $(event.currentTarget).data("message-id");
|
||||
const thread = this.chatter.thread;
|
||||
var self = this;
|
||||
this.env.bus.trigger("do-action", {
|
||||
action: "mail.mail_resend_message_action",
|
||||
options: {
|
||||
additional_context: {
|
||||
mail_message_to_resend: messageID,
|
||||
},
|
||||
on_close: () => {
|
||||
self.trigger("reload", {keepChanges: true});
|
||||
thread.refresh();
|
||||
},
|
||||
},
|
||||
on_close: () => {
|
||||
self.trigger("reload", {keepChanges: true});
|
||||
thread.refresh();
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
_onMarkFailedMessageReviewed(event) {
|
||||
event.preventDefault();
|
||||
var messageID = $(event.currentTarget).data("message-id");
|
||||
this._markFailedMessageReviewed(messageID);
|
||||
this.trigger("reload", {keepChanges: true});
|
||||
this.chatter.thread.refreshMessagefailed();
|
||||
this.chatter.thread.refresh();
|
||||
});
|
||||
}
|
||||
_onMarkFailedMessageReviewed(event) {
|
||||
event.preventDefault();
|
||||
var messageID = $(event.currentTarget).data("message-id");
|
||||
this._markFailedMessageReviewed(messageID);
|
||||
this.trigger("reload", {keepChanges: true});
|
||||
this.chatter.thread.refreshMessagefailed();
|
||||
this.chatter.thread.refresh();
|
||||
}
|
||||
}
|
||||
MessageFailedBox.template = "mail_tracking.MessageFailedBox";
|
||||
MessageFailedBox.props = {
|
||||
chatterLocalId: String,
|
||||
};
|
||||
chatter.components = Object.assign({}, chatter.components, {
|
||||
MessageFailedBox,
|
||||
});
|
||||
return MessageFailedBox;
|
||||
}
|
||||
MessageFailedBox.template = "mail_tracking.MessageFailedBox";
|
||||
MessageFailedBox.props = {
|
||||
chatterLocalId: String,
|
||||
};
|
||||
chatter.components = Object.assign({}, chatter.components, {
|
||||
MessageFailedBox,
|
||||
});
|
||||
return MessageFailedBox;
|
||||
});
|
||||
);
|
||||
|
1
setup/mail_tracking/odoo/addons/mail_tracking
Symbolic link
1
setup/mail_tracking/odoo/addons/mail_tracking
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../mail_tracking
|
6
setup/mail_tracking/setup.py
Normal file
6
setup/mail_tracking/setup.py
Normal file
@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
Loading…
Reference in New Issue
Block a user