diff --git a/addons/web/static/src/js/views/abstract_controller.js b/addons/web/static/src/js/views/abstract_controller.js index b90b1448ce2..3d9db03eb1c 100644 --- a/addons/web/static/src/js/views/abstract_controller.js +++ b/addons/web/static/src/js/views/abstract_controller.js @@ -210,7 +210,7 @@ var AbstractController = Widget.extend({ * @param {boolean} hasNoContent */ _toggleNoContentHelper: function (hasNoContent) { - if (hasNoContent) { + if (hasNoContent && this.noContentHelp) { this.renderer.$el.detach(); var $msg = $('
') .addClass('oe_view_nocontent') diff --git a/addons/web/static/test/views/list_tests.js b/addons/web/static/test/views/list_tests.js index e88361b5e38..9b04573ed23 100644 --- a/addons/web/static/test/views/list_tests.js +++ b/addons/web/static/test/views/list_tests.js @@ -735,6 +735,27 @@ QUnit.module('Views', { list.destroy(); }); + QUnit.test('no nocontent helper when no data and no help', function (assert) { + assert.expect(3); + + this.data.foo.records = []; + + var list = createView({ + View: ListView, + model: 'foo', + data: this.data, + arch: '', + }); + + assert.strictEqual(list.$('.oe_view_nocontent').length, 0, + "should not display the no content helper"); + + assert.strictEqual(list.$('tr.o_data_row').length, 0, + "should not have any data row"); + + assert.strictEqual(list.$('table').length, 1, "should have a table in the dom"); + list.destroy(); + }); QUnit.test('list view, editable, without data', function (assert) { assert.expect(9); @@ -752,6 +773,11 @@ QUnit.module('Views', { '' + '' + '', + viewOptions: { + action: { + help: '

click to add a partner

' + } + }, mockRPC: function (route, args) { if (args.method === 'create') { assert.ok(true, "should have created a record");