[MIG] mail_quoted_reply: Migration to 14.0
This commit is contained in:
parent
e14f90796c
commit
0eb189f1c4
@ -5,11 +5,14 @@
|
||||
"name": "Mail Message Reply",
|
||||
"summary": """
|
||||
Make a reply using a message""",
|
||||
"version": "13.0.1.0.0",
|
||||
"version": "14.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "Creu Blanca,Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/social",
|
||||
"depends": ["mail"],
|
||||
"qweb": ["static/src/xml/mail_message_reply.xml"],
|
||||
"data": ["templates/assets.xml", "data/reply_template.xml"],
|
||||
"data": [
|
||||
"templates/assets.xml",
|
||||
"data/reply_template.xml",
|
||||
],
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
odoo.define("mail_quoted_reply/static/src/components/mail_message_reply.js", function (
|
||||
require
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
const components = {
|
||||
Message: require("mail/static/src/components/message/message.js"),
|
||||
};
|
||||
const {patch} = require("web.utils");
|
||||
|
||||
patch(
|
||||
components.Message,
|
||||
"mail_quoted_reply/static/src/models/mail_message_reply.js",
|
||||
{
|
||||
_onClickMailMessageReply() {
|
||||
this.message._onClickMailMessageReply();
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
@ -1,60 +0,0 @@
|
||||
/* Copyright 2021 Creu Blanca
|
||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
*/
|
||||
odoo.define("mail_quote_reply.reply", function(require) {
|
||||
"use strict";
|
||||
|
||||
var ThreadWidget = require("mail.widget.Thread");
|
||||
var ThreadField = require("mail.ThreadField");
|
||||
var DocumentThread = require("mail.model.DocumentThread");
|
||||
|
||||
DocumentThread.include({
|
||||
_fetchMessages: function(options) {
|
||||
if (options && options.forceReloadMessages) {
|
||||
this._mustFetchMessageIDs = true;
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
});
|
||||
|
||||
ThreadField.include({
|
||||
start: function() {
|
||||
var self = this;
|
||||
return this._super.apply(this, arguments).then(function() {
|
||||
self._threadWidget.on(
|
||||
"reload_thread_messages",
|
||||
self,
|
||||
self._onReloadThreadMessages
|
||||
);
|
||||
});
|
||||
},
|
||||
_onReloadThreadMessages: function() {
|
||||
this._fetchAndRenderThread({forceReloadMessages: true});
|
||||
},
|
||||
});
|
||||
|
||||
ThreadWidget.include({
|
||||
events: _.defaults(
|
||||
{
|
||||
"click .o_thread_mail_message_reply": "_onClickMailMessageReply",
|
||||
},
|
||||
ThreadWidget.prototype.events
|
||||
),
|
||||
|
||||
_onClickMailMessageReply: function(event) {
|
||||
var self = this,
|
||||
msg_id = $(event.currentTarget).data("message-id");
|
||||
this._rpc({
|
||||
model: "mail.message",
|
||||
method: "reply_message",
|
||||
args: [msg_id],
|
||||
}).then(function(result) {
|
||||
self.do_action(result, {
|
||||
on_close: function() {
|
||||
self.trigger("reload_thread_messages");
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
34
mail_quoted_reply/static/src/models/mail_message_reply.js
Normal file
34
mail_quoted_reply/static/src/models/mail_message_reply.js
Normal file
@ -0,0 +1,34 @@
|
||||
odoo.define("mail_quoted_reply/static/src/models/mail_message_reply.js", function (
|
||||
require
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
const {registerInstancePatchModel} = require("mail/static/src/model/model_core.js");
|
||||
|
||||
registerInstancePatchModel(
|
||||
"mail.message",
|
||||
"mail_quoted_reply/static/src/models/mail_message_reply.js",
|
||||
{
|
||||
_onClickMailMessageReply: function () {
|
||||
var self = this,
|
||||
msg_id = this.id;
|
||||
this.env.services
|
||||
.rpc({
|
||||
model: "mail.message",
|
||||
method: "reply_message",
|
||||
args: [msg_id],
|
||||
})
|
||||
.then(function (result) {
|
||||
self.env.bus.trigger("do-action", {
|
||||
action: result,
|
||||
options: {
|
||||
on_close: () => {
|
||||
self.originThread.refresh();
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
@ -0,0 +1,21 @@
|
||||
.o_thread_mail_message_reply {
|
||||
cursor: pointer;
|
||||
color: gray("400");
|
||||
&:not(.o-mobile) {
|
||||
&:hover {
|
||||
filter: brightness(0.8);
|
||||
}
|
||||
}
|
||||
|
||||
&.o-mobile {
|
||||
filter: brightness(0.8);
|
||||
|
||||
&:hover {
|
||||
filter: brightness(0.75);
|
||||
}
|
||||
}
|
||||
|
||||
&.o-message-selected {
|
||||
color: gray("500");
|
||||
}
|
||||
}
|
@ -2,16 +2,18 @@
|
||||
<!-- Copyright 2021 Creu Blanca
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
|
||||
<template>
|
||||
<t t-extend="mail.widget.Thread.Message">
|
||||
<t t-jquery=".o_thread_message_reply" t-operation="after">
|
||||
<i
|
||||
t-if="message.isLinkedToDocumentThread() and !options.displayReplyIcons and !message.isSystemNotification()"
|
||||
class="fa fa-reply o_thread_icon o_thread_mail_message_reply"
|
||||
t-att-data-message-id="message.getID()"
|
||||
title="Reply"
|
||||
role="img"
|
||||
aria-label="Reply"
|
||||
/>
|
||||
</t>
|
||||
<t t-inherit="mail.Message" t-inherit-mode="extension">
|
||||
<xpath
|
||||
expr="//div[hasclass('o_Message_core')]//div[hasclass('o_Message_headerCommands')]/t[1]"
|
||||
position="inside"
|
||||
>
|
||||
<t>
|
||||
<span
|
||||
class="fa fa-reply o_thread_icon o_thread_mail_message_reply"
|
||||
t-on-click="_onClickMailMessageReply"
|
||||
title="Reply"
|
||||
/>
|
||||
</t>
|
||||
</xpath>
|
||||
</t>
|
||||
</template>
|
||||
|
@ -12,7 +12,16 @@
|
||||
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/mail_quoted_reply/static/src/js/mail_message_reply.js"
|
||||
src="/mail_quoted_reply/static/src/components/mail_message_reply.js"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/mail_quoted_reply/static/src/models/mail_message_reply.js"
|
||||
/>
|
||||
<link
|
||||
href="/mail_quoted_reply/static/src/scss/thread_mail_message_reply.scss"
|
||||
rel="stylesheet"
|
||||
type="text/scss"
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
1
setup/mail_quoted_reply/odoo/addons/mail_quoted_reply
Symbolic link
1
setup/mail_quoted_reply/odoo/addons/mail_quoted_reply
Symbolic link
@ -0,0 +1 @@
|
||||
../../../../mail_quoted_reply
|
6
setup/mail_quoted_reply/setup.py
Normal file
6
setup/mail_quoted_reply/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