From 324634da3debefd834b4b5dcf8509da25348324d Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Mon, 17 Jun 2019 08:20:41 +0000 Subject: [PATCH] [FIX] mail: automatically fetch new attachments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create an invoice, validate it, print the invoice from the print menu, as of the paperclip value in the chatter, an attachment has been added. But if you click on the paperclip, there are no attachments. You need to reload the page in order to access the attachments. The problem is the internal flag indicating that all attachments are fetched is wrong. This fix resets the flag when the paper clip value changes. opw-2008344 closes odoo/odoo#34171 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/js/chatter.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/chatter.js b/addons/mail/static/src/js/chatter.js index 635d261bf3f..c0220a7b1b8 100644 --- a/addons/mail/static/src/js/chatter.js +++ b/addons/mail/static/src/js/chatter.js @@ -435,7 +435,11 @@ var Chatter = Widget.extend({ */ _updateAttachmentCounter: function () { var count = this.record.data.message_attachment_count || 0; - this.$('.o_chatter_attachment_button_count').html(count); + var $element = this.$('.o_chatter_attachment_button_count'); + if (Number($element.html()) !== count) { + this._areAttachmentsLoaded = false; + $element.html(count); + } }, /** * @private