Skip to content
Snippets Groups Projects
Commit 61d1fdf9 authored by Hubert Van de Walle (huvw)'s avatar Hubert Van de Walle (huvw)
Browse files

[FIX] board: empty dashboard fails to render on mobile


Steps to reproduce
==================

- Go on a 14.0 runbot
- Open dashboard

```
TypeError: Cannot read properties of undefined (reading 'split')
    at Class.changeLayout
```

Cause of the issue
==================

`.oe_dashboard` isn't rendered on an empty dashboard

opw-3469183

closes odoo/odoo#132297

X-original-commit: bc51651a
Signed-off-by: default avatarRomain Estievenart (res) <res@odoo.com>
Signed-off-by: default avatarHubert Van De Walle <huvw@odoo.com>
parent 739b8739
No related branches found
No related tags found
No related merge requests found
......@@ -181,6 +181,9 @@ var BoardRenderer = FormRenderer.extend({
*/
changeLayout: function (layout) {
var $dashboard = this.$('.oe_dashboard');
if (!$dashboard.length) {
return;
}
var current_layout = $dashboard.attr('data-layout');
if (current_layout !== layout) {
var clayout = current_layout.split('-').length,
......
......@@ -113,4 +113,35 @@ odoo.define("board.dashboard_tests", function (require) {
target.destroy();
});
QUnit.test("empty board view", async function (assert) {
assert.expect(2);
const target = await createView({
View: BoardView,
debug: 1,
model: "board",
data: this.data,
arch: `<form string="My Dashboard">
<board style="2-1">
<column/>
</board>
</form>`,
archs: {
"partner,4,list": '<tree string="Partner"><field name="foo"/></tree>',
},
});
assert.hasClass(
target.renderer.$el,
"o_dashboard",
"with a dashboard, the renderer should have the proper css class"
);
assert.containsOnce(
target,
".o_dashboard .o_view_nocontent",
"should have a no content helper"
);
target.destroy();
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment