From 0b973f7461c98f3de0d49a277f396bc37c642394 Mon Sep 17 00:00:00 2001 From: fw-bot Date: Mon, 7 Oct 2019 19:53:44 +0000 Subject: [PATCH] [REF] mail: separate button rendering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit original PR: https://github.com/odoo/odoo/pull/25801 closes odoo/odoo#38141 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/js/chatter.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/addons/mail/static/src/js/chatter.js b/addons/mail/static/src/js/chatter.js index 153bd5fa3a2..e3fe4485c28 100644 --- a/addons/mail/static/src/js/chatter.js +++ b/addons/mail/static/src/js/chatter.js @@ -92,15 +92,7 @@ var Chatter = Widget.extend({ start: function () { this._$topbar = this.$('.o_chatter_topbar'); // render and append the buttons - this._$topbar.prepend(QWeb.render('mail.chatter.Buttons', { - newMessageButton: !!this.fields.thread, - logNoteButton: this.hasLogButton, - scheduleActivityButton: !!this.fields.activity, - isMobile: config.device.isMobile, - disableAttachmentBox: this._disableAttachmentBox, - displayCounter: !!this.fields.thread, - count: this.record.data.message_attachment_count || 0, - })); + this._$topbar.prepend(this._renderButtons()); // start and append the widgets var fieldDefs = _.invoke(this.fields, 'appendTo', $('
')); var def = this._dp.add(Promise.all(fieldDefs)); @@ -417,6 +409,17 @@ var Chatter = Widget.extend({ _resetSuggestedPartners() { this._suggestedPartnersProm = undefined; }, + _renderButtons: function () { + return QWeb.render('mail.chatter.Buttons', { + newMessageButton: !!this.fields.thread, + logNoteButton: this.hasLogButton, + scheduleActivityButton: !!this.fields.activity, + isMobile: config.device.isMobile, + disableAttachmentBox: this._disableAttachmentBox, + displayCounter: !!this.fields.thread, + count: this.record.data.message_attachment_count || 0, + }); + }, /** * @private * @param {Object} record