[FIX] web: display buttons without icon in list view

Previously, the button was completely invisible when no icon
was given, which is a regression from saas-15 where the string
attribute is used to write the button label.
This commit is contained in:
David Monjoie
2017-06-19 07:56:41 +02:00
parent 8859d25bc5
commit 584c60f1ba
2 changed files with 24 additions and 2 deletions
@@ -271,10 +271,14 @@ var ListRenderer = BasicRenderer.extend({
_renderButton: function (record, node) {
var $button = $('<button>', {
type: 'button',
class: 'o_icon_button',
title: node.attrs.string,
});
$button.append($('<i>', {class: 'fa ' + node.attrs.icon}));
if (node.attrs.icon) {
$button.addClass('o_icon_button');
$button.append($('<i>', {class: 'fa ' + node.attrs.icon}));
} else {
$button.text(node.attrs.string);
}
this._registerModifiers(node, record, $button);
@@ -1046,6 +1046,24 @@ QUnit.module('Views', {
list.destroy();
});
QUnit.test('list view with a button without icon', function (assert) {
assert.expect(1);
var list = createView({
View: ListView,
model: 'foo',
data: this.data,
arch: '<tree string="Phonecalls" editable="top">' +
'<field name="foo"/>' +
'<button string="abc" type="object" name="schedule_another_phonecall"/>' +
'</tree>',
});
assert.strictEqual(list.$('table button').first().text(), 'abc',
"should have rendered a button with string attribute as label");
list.destroy();
});
QUnit.test('list view, editable, can discard', function (assert) {
assert.expect(5);