diff --git a/addons/web/static/src/views/graph/graph_renderer.xml b/addons/web/static/src/views/graph/graph_renderer.xml index 7ad4e1b7638..29333a22286 100644 --- a/addons/web/static/src/views/graph/graph_renderer.xml +++ b/addons/web/static/src/views/graph/graph_renderer.xml @@ -6,16 +6,16 @@ - -
+
- - + + +
@@ -25,9 +25,9 @@
- +
- \ No newline at end of file + diff --git a/addons/web/static/src/views/graph/graph_view.js b/addons/web/static/src/views/graph/graph_view.js index 62bdaf869a0..a295bb19f4a 100644 --- a/addons/web/static/src/views/graph/graph_view.js +++ b/addons/web/static/src/views/graph/graph_view.js @@ -1,17 +1,16 @@ /** @odoo-module **/ import { _lt } from "@web/core/l10n/translation"; -import { ControlPanel } from "@web/search/control_panel/control_panel"; -import { SearchPanel } from "@web/search/search_panel/search_panel"; +import { registry } from "@web/core/registry"; +import { useService } from "@web/core/utils/hooks"; +import { GroupByMenu } from "@web/search/group_by_menu/group_by_menu"; +import { standardViewProps } from "@web/views/helpers/standard_view_props"; +import { useSetupView } from "@web/views/helpers/view_hook"; +import { Layout } from "@web/views/layout"; +import { useModel } from "../helpers/model"; import { GraphArchParser } from "./graph_arch_parser"; import { GraphModel } from "./graph_model"; import { GraphRenderer } from "./graph_renderer"; -import { GroupByMenu } from "@web/search/group_by_menu/group_by_menu"; -import { registry } from "@web/core/registry"; -import { standardViewProps } from "@web/views/helpers/standard_view_props"; -import { useModel } from "../helpers/model"; -import { useService } from "@web/core/utils/hooks"; -import { useSetupView } from "@web/views/helpers/view_hook"; const viewRegistry = registry.category("views"); @@ -74,7 +73,7 @@ export class GraphView extends Component { const { context, resModel, title } = this.model.metaData; const views = {}; - for (const [viewId, viewType] of this.props.info.views || []) { + for (const [viewId, viewType] of this.env.config.views || []) { views[viewType] = viewId; } function getView(viewType) { @@ -131,7 +130,7 @@ export class GraphView extends Component { GraphView.template = "web.GraphView"; GraphView.buttonTemplate = "web.GraphView.Buttons"; -GraphView.components = { ControlPanel, GroupByMenu, Renderer: GraphRenderer, SearchPanel }; +GraphView.components = { GroupByMenu, Renderer: GraphRenderer, Layout }; GraphView.defaultProps = { additionalMeasures: [], diff --git a/addons/web/static/src/views/graph/graph_view.scss b/addons/web/static/src/views/graph/graph_view.scss index e88aaaa2939..955635f6418 100644 --- a/addons/web/static/src/views/graph/graph_view.scss +++ b/addons/web/static/src/views/graph/graph_view.scss @@ -1,4 +1,4 @@ -.o_graph_view { +.o_graph_view > .o_content > .o_renderer { height: 100%; .o_graph_canvas_container { diff --git a/addons/web/static/src/views/graph/graph_view.xml b/addons/web/static/src/views/graph/graph_view.xml index 3dae48a71aa..d900401bfc1 100644 --- a/addons/web/static/src/views/graph/graph_view.xml +++ b/addons/web/static/src/views/graph/graph_view.xml @@ -46,31 +46,26 @@ -
- - - + + + + + + + - -
- - - - - - - - - Invalid data - Pie chart cannot mix positive and negative numbers. Try to change your domain to only display positive results - -
-
+ +
+ + Invalid data + Pie chart cannot mix positive and negative numbers. Try to change your domain to only display positive results + + diff --git a/addons/web/static/tests/views/graph_view_tests.js b/addons/web/static/tests/views/graph_view_tests.js index c5649280149..1670d9c6c74 100644 --- a/addons/web/static/tests/views/graph_view_tests.js +++ b/addons/web/static/tests/views/graph_view_tests.js @@ -1,13 +1,7 @@ /** @odoo-module **/ -import { BORDER_WHITE, DEFAULT_BG } from "@web/views/graph/colors"; -import { dialogService } from "@web/core/dialog/dialog_service"; -import { GraphArchParser } from "@web/views/graph/graph_arch_parser"; -import { registry } from "@web/core/registry"; -import { makeView } from "./helpers"; -import { click, makeDeferred, nextTick, triggerEvent } from "@web/../tests/helpers/utils"; import { makeFakeLocalizationService } from "@web/../tests/helpers/mock_services"; -import { createWebClient, doAction } from "@web/../tests/webclient/helpers"; +import { click, makeDeferred, nextTick, triggerEvent } from "@web/../tests/helpers/utils"; import { editFavoriteName, saveFavorite, @@ -22,6 +16,12 @@ import { toggleMenuItemOption, toggleSaveFavorite, } from "@web/../tests/search/helpers"; +import { makeView } from "@web/../tests/views/helpers"; +import { createWebClient, doAction } from "@web/../tests/webclient/helpers"; +import { dialogService } from "@web/core/dialog/dialog_service"; +import { registry } from "@web/core/registry"; +import { BORDER_WHITE, DEFAULT_BG } from "@web/views/graph/colors"; +import { GraphArchParser } from "@web/views/graph/graph_arch_parser"; const serviceRegistry = registry.category("services"); @@ -30,7 +30,8 @@ function getGraphModelMetaData(graph) { } export function getGraphRenderer(graph) { - return Object.values(graph.__owl__.children).find((c) => c.chart); + const layout = Object.values(graph.__owl__.children)[0]; + return Object.values(layout.__owl__.children).find((c) => c.chart); } function getChart(graph) { @@ -2031,26 +2032,9 @@ QUnit.module("Views", (hooks) => { type: "graph", resModel: "foo", noContentHelp: '

This helper should not be displayed in graph views

', - views: [[false, "search"]], - }); - assert.containsOnce(graph, "div.o_graph_canvas_container canvas"); - assert.containsNone(graph, "div.o_view_nocontent"); - assert.containsNone(graph, ".abc"); - await toggleFilterMenu(graph); - await toggleMenuItem(graph, "False Domain"); - assert.containsOnce(graph, "div.o_graph_canvas_container canvas"); - assert.containsNone(graph, "div.o_view_nocontent"); - assert.containsNone(graph, ".abc"); - }); - - QUnit.test("no content helper after update", async function (assert) { - assert.expect(6); - const graph = await makeView({ - serverData, - type: "graph", - resModel: "foo", - noContentHelp: '

This helper should not be displayed in graph views

', - views: [[false, "search"]], + config: { + views: [[false, "search"]], + }, }); assert.containsOnce(graph, "div.o_graph_canvas_container canvas"); assert.containsNone(graph, "div.o_view_nocontent"); @@ -2719,7 +2703,9 @@ QUnit.module("Views", (hooks) => { resModel: "foo", groupBy: ["date:year", "product_id", "date", "date:quarter"], arch: ``, - views: [[false, "search"]], + config: { + views: [[false, "search"]], + }, }); checkLabels(assert, graph, ["January 2016", "March 2016", "May 2016", "April 2016"]); // mockReadGroup does not always sort groups -> May 2016 is before April 2016 for that reason. @@ -2748,7 +2734,9 @@ QUnit.module("Views", (hooks) => { serverData, type: "graph", resModel: "foo", - displayName: "Glou glou", + config: { + displayName: "Glou glou", + }, }); assert.strictEqual( graph.el.querySelector(".o_control_panel .breadcrumb-item.active").innerText, @@ -2851,10 +2839,12 @@ QUnit.module("Views", (hooks) => { `, - views: [ - [364, "list"], - [29, "form"], - ], + config: { + views: [ + [364, "list"], + [29, "form"], + ], + }, }); checkModeIs(assert, graph, "pie"); checkDatasets(assert, graph, ["domains"], { @@ -3093,7 +3083,7 @@ QUnit.module("Views", (hooks) => { type: "graph", resModel: "foo", arch: ` - +