summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/thread_field.js
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2017-11-16 13:52:40 +0100
committerMartin Geubelle <mge@odoo.com>2017-11-17 10:47:49 +0100
commitab900bb62a6c6fecc6940e2ef04c2ccf4986372c (patch)
tree98e58362a4f3cde45585971a19248ece60c4f97f /addons/mail/static/src/js/thread_field.js
parent745d00362ab8353bf88457b05f090c470f780ef5 (diff)
[FIX] mail: keep model informed of new messages
Do not forward-port this after 11.0 After sending a message, if one switched in edit mode in the form view, the created message disappeared. This is because the model is not aware of messages (they are created through their own routes, message are not handled as other one2many fields with commands) and the widget was reset with a new datapoint instance when switching in edit mode. In this rev. we keep the model informed of the new messages by directly writing the message ids in the datapoint. Note that the includes on FormController and BasicModel are one in the form_renderer.js file to fix this issue in existing database without adding files. Another revision will be done in master to add the correct files. opw-781353
Diffstat (limited to 'addons/mail/static/src/js/thread_field.js')
-rw-r--r--addons/mail/static/src/js/thread_field.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/addons/mail/static/src/js/thread_field.js b/addons/mail/static/src/js/thread_field.js
index 0d7635cae8b..75e379e6ea1 100644
--- a/addons/mail/static/src/js/thread_field.js
+++ b/addons/mail/static/src/js/thread_field.js
@@ -107,6 +107,10 @@ var ThreadField = AbstractField.extend(chat_mixin, {
_onNewMessage: function (message) {
if (message.model === this.model && message.res_id === this.res_id) {
this.msgIDs.unshift(message.id);
+ this.trigger_up('new_message', {
+ id: this.value.id,
+ msgIDs: this.msgIDs,
+ });
this._fetchAndRenderThread(this.msgIDs);
}
},