From 6a5dab9c64f4c6ee95f978cab45e08422a14897a Mon Sep 17 00:00:00 2001 From: Nans Lefebvre Date: Wed, 3 Apr 2019 14:00:33 +0000 Subject: [PATCH] [FIX] mail: reload the record when uploading attachments if post_refresh is set to always When post_refresh is set to 'always', the displayed record is entirely reloaded each time a message is posted in the chatter. However no such thing exists for when attachments are uploaded. This is of use e.g. when in the view there are fields that have attributes that depend on computed fields, themselves dependent on the record's attachments. One such case is the OCR. opw 1950403 --- addons/mail/static/src/js/chatter.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/mail/static/src/js/chatter.js b/addons/mail/static/src/js/chatter.js index 72971fbeee9..5f9b11198e3 100644 --- a/addons/mail/static/src/js/chatter.js +++ b/addons/mail/static/src/js/chatter.js @@ -81,6 +81,7 @@ var Chatter = Widget.extend({ var nodeOptions = fieldsInfo[mailFields.mail_thread].options || {}; this.hasLogButton = options.display_log_button || nodeOptions.display_log_button; this.postRefresh = nodeOptions.post_refresh || 'never'; + this.reloadOnUploadAttachment = this.postRefresh === 'always'; } }, /** @@ -572,6 +573,9 @@ var Chatter = Widget.extend({ * @private */ _onReloadAttachmentBox: function () { + if (this.reloadOnUploadAttachment) { + this.trigger_up('reload'); + } this._reloadAttachmentBox(); }, /**