From af948c6acf01fe2e6df7c29fdc8996128d132889 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 18 Jan 2023 10:20:50 +0000 Subject: [PATCH] [FIX] board: better display graphs in dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the legacy implementation of the dashboard action, there was a scss rule that set the height of the canvas of graph views inside the dashboard to 300px. During the conversion to owl, this rule has been lost. As a consequence, graphs in the dashboard look squashed. This commit restores the scss rule to fix the issue. Bug reported in the feedback pad after migrating odoo.com to 16.0. closes odoo/odoo#110352 X-original-commit: 833f7394ecd88825990eb7d1b338e21bfbab55b5 Signed-off-by: Géry Debongnie Signed-off-by: Aaron Bohy (aab) --- addons/board/static/src/board_controller.scss | 3 ++ addons/board/static/tests/board_test.js | 36 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/addons/board/static/src/board_controller.scss b/addons/board/static/src/board_controller.scss index b2207c87a50..3e849619c94 100644 --- a/addons/board/static/src/board_controller.scss +++ b/addons/board/static/src/board_controller.scss @@ -31,6 +31,9 @@ > .o_view_controller { padding: 0 12px 12px 12px; + .o_graph_renderer canvas { + height: 300px; + } } .o_column_quick_create { diff --git a/addons/board/static/tests/board_test.js b/addons/board/static/tests/board_test.js index 4b03b8c700c..46a1c6b0a90 100644 --- a/addons/board/static/tests/board_test.js +++ b/addons/board/static/tests/board_test.js @@ -1,6 +1,7 @@ /** @odoo-module **/ import { BoardAction } from "@board/board_action"; +import { fakeCookieService } from "@web/../tests/helpers/mock_services"; import { click, dragAndDrop, getFixture, patchWithCleanup } from "@web/../tests/helpers/utils"; import { makeView, setupViewRegistries } from "@web/../tests/views/helpers"; import { registry } from "@web/core/registry"; @@ -720,4 +721,39 @@ QUnit.module("Board", (hooks) => { assert.verifySteps(["do action"]); }); + + QUnit.test("graphs in dashboard aren't squashed", async function (assert) { + registry.category("services").add("cookie", fakeCookieService); + + serverData.views["partner,4,graph"] = + ''; + + await makeView({ + serverData, + type: "form", + resModel: "board", + arch: ` +
+ + + + + +
`, + mockRPC(route, args) { + if (route === "/web/action/load") { + return Promise.resolve({ + res_model: "partner", + views: [[4, "graph"]], + }); + } + }, + }); + + assert.containsOnce(target, ".o-dashboard-action .o_graph_renderer"); + assert.strictEqual( + target.querySelector(".o-dashboard-action .o_graph_renderer canvas").offsetHeight, + 300 + ); + }); });