diff --git a/addons/mail/static/src/js/chatter.js b/addons/mail/static/src/js/chatter.js index 330e56b77b4..72971fbeee9 100644 --- a/addons/mail/static/src/js/chatter.js +++ b/addons/mail/static/src/js/chatter.js @@ -90,6 +90,7 @@ var Chatter = Widget.extend({ this._$topbar = this.$('.o_chatter_topbar'); if(!this._disableAttachmentBox) { this.$('.o_topbar_right_area').append(QWeb.render('mail.chatter.Attachment.Button', { + displayCounter: !!this.fields.thread, count: this.record.data.message_attachment_count || 0, })); } @@ -362,7 +363,9 @@ var Chatter = Widget.extend({ if (this._isAttachmentBoxOpen) { this._fetchAttachments().then(this._openAttachmentBox.bind(this)); } - this.trigger_up('reload', { fieldNames: ['message_attachment_count'] }); + if (this.fields.thread) { + this.trigger_up('reload', { fieldNames: ['message_attachment_count'] }); + } }, /** * @private @@ -490,7 +493,9 @@ var Chatter = Widget.extend({ }) .then(function () { self._reloadAttachmentBox(); - self.fields.thread.removeAttachments([ev.data.attachmentId]); + if (self.fields.thread) { + self.fields.thread.removeAttachments([ev.data.attachmentId]); + } self.trigger_up('reload'); }); } diff --git a/addons/mail/static/src/xml/chatter.xml b/addons/mail/static/src/xml/chatter.xml index 7f8629f1bae..7fe1eeebd77 100644 --- a/addons/mail/static/src/xml/chatter.xml +++ b/addons/mail/static/src/xml/chatter.xml @@ -105,11 +105,17 @@ +