[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
|
@api.model
|
||||||
def get_failed_count(self):
|
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)])
|
return self.search_count([("is_failed_message", "=", True)])
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
|
@ -1,75 +1,76 @@
|
|||||||
odoo.define("mail_tracking/static/src/js/failed_message/mail_failed_box.js", function (
|
odoo.define(
|
||||||
require
|
"mail_tracking/static/src/js/failed_message/mail_failed_box.js",
|
||||||
) {
|
function (require) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const chatter = require("mail/static/src/components/chatter/chatter.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 useStore = require("mail/static/src/component_hooks/use_store/use_store.js");
|
||||||
|
|
||||||
const {Component} = owl;
|
const {Component} = owl;
|
||||||
|
|
||||||
class MessageFailedBox extends Component {
|
class MessageFailedBox extends Component {
|
||||||
constructor(...args) {
|
constructor(...args) {
|
||||||
super(...args);
|
super(...args);
|
||||||
useStore((props) => {
|
useStore((props) => {
|
||||||
const chatter = this.env.models["mail.chatter"].get(
|
const chatter = this.env.models["mail.chatter"].get(
|
||||||
props.chatterLocalId
|
props.chatterLocalId
|
||||||
);
|
);
|
||||||
const thread = chatter && chatter.thread;
|
const thread = chatter && chatter.thread;
|
||||||
return {
|
return {
|
||||||
chatter: chatter ? chatter.__state : undefined,
|
chatter: chatter ? chatter.__state : undefined,
|
||||||
thread: thread && thread.__state,
|
thread: thread && thread.__state,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get chatter() {
|
get chatter() {
|
||||||
return this.env.models["mail.chatter"].get(this.props.chatterLocalId);
|
return this.env.models["mail.chatter"].get(this.props.chatterLocalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onClickTitle() {
|
_onClickTitle() {
|
||||||
this.chatter.toggleMessageFailedBoxVisibility();
|
this.chatter.toggleMessageFailedBoxVisibility();
|
||||||
}
|
}
|
||||||
_markFailedMessageReviewed(id) {
|
_markFailedMessageReviewed(id) {
|
||||||
return this.env.services.rpc({
|
return this.env.services.rpc({
|
||||||
model: "mail.message",
|
model: "mail.message",
|
||||||
method: "set_need_action_done",
|
method: "set_need_action_done",
|
||||||
args: [[id]],
|
args: [[id]],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_onRetryFailedMessage(event) {
|
_onRetryFailedMessage(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var messageID = $(event.currentTarget).data("message-id");
|
var messageID = $(event.currentTarget).data("message-id");
|
||||||
const thread = this.chatter.thread;
|
const thread = this.chatter.thread;
|
||||||
var self = this;
|
var self = this;
|
||||||
this.env.bus.trigger("do-action", {
|
this.env.bus.trigger("do-action", {
|
||||||
action: "mail.mail_resend_message_action",
|
action: "mail.mail_resend_message_action",
|
||||||
options: {
|
options: {
|
||||||
additional_context: {
|
additional_context: {
|
||||||
mail_message_to_resend: messageID,
|
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});
|
||||||
_onMarkFailedMessageReviewed(event) {
|
this.chatter.thread.refreshMessagefailed();
|
||||||
event.preventDefault();
|
this.chatter.thread.refresh();
|
||||||
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