[FIX] board: better display graphs in dashboard

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 <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Aaron Bohy
2023-01-19 09:13:17 +01:00
parent 942ef925b9
commit af948c6acf
2 changed files with 39 additions and 0 deletions
@@ -31,6 +31,9 @@
> .o_view_controller {
padding: 0 12px 12px 12px;
.o_graph_renderer canvas {
height: 300px;
}
}
.o_column_quick_create {
+36
View File
@@ -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"] =
'<graph><field name="int_field" type="measure"/></graph>';
await makeView({
serverData,
type: "form",
resModel: "board",
arch: `
<form string="My Dashboard" js_class="board">
<board style="2-1">
<column>
<action string="ABC" name="51"></action>
</column>
</board>
</form>`,
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
);
});
});