[REF] mail: separate button rendering

original PR: https://github.com/odoo/odoo/pull/25801

closes odoo/odoo#38141

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
fw-bot
2019-10-07 20:00:58 +00:00
committed by Alexandre Kühn
parent cc0eb76726
commit 0b973f7461
+12 -9
View File
@@ -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', $('<div>'));
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