[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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user