From b6be3987439be44c6f1c09552e162e13d6d52166 Mon Sep 17 00:00:00 2001 From: "Simon Genin (ges)" Date: Mon, 27 Sep 2021 14:48:52 +0000 Subject: [PATCH] [FIX] web: Allow the graph context option fill_temporal to be set The option was available before but was forgotten when the graph view was refactored. closes odoo/odoo#77330 X-original-commit: 624fd812c5d6b01c0cc11e8620dc703dc0370f73 Signed-off-by: Aaron Bohy (aab) --- .../web/static/src/views/graph/graph_model.js | 2 +- .../static/tests/views/graph_view_tests.js | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/views/graph/graph_model.js b/addons/web/static/src/views/graph/graph_model.js index 5fd8e1e745d..d72f178988f 100644 --- a/addons/web/static/src/views/graph/graph_model.js +++ b/addons/web/static/src/views/graph/graph_model.js @@ -414,7 +414,7 @@ export class GraphModel extends Model { measures, groupBy.map((gb) => gb.spec), { lazy: false }, // what is this thing??? - { fill_temporal: true } // + old this.chart.context + { fill_temporal: true, ...this.searchParams.context } ) .then((data) => { const dataPoints = []; diff --git a/addons/web/static/tests/views/graph_view_tests.js b/addons/web/static/tests/views/graph_view_tests.js index 87f55a6dc75..f20971092f9 100644 --- a/addons/web/static/tests/views/graph_view_tests.js +++ b/addons/web/static/tests/views/graph_view_tests.js @@ -3478,4 +3478,43 @@ QUnit.module("Views", (hooks) => { ]); checkDatasets(assert, graph, "data", { data: [56, 26, 4, 105, 48] }); }); + + QUnit.test("fill_temporal is true by default", async function (assert) { + assert.expect(1); + + const graph = await makeView({ + serverData, + type: "graph", + resModel: "foo", + mockRPC: function (route, args) { + if (args.method === "web_read_group") { + assert.strictEqual( + args.kwargs.context.fill_temporal, + true, + "The observal state of fill_temporal should be true" + ); + } + }, + }); + }); + + QUnit.test("fill_temporal can be changed throught the context", async function (assert) { + assert.expect(1); + + const graph = await makeView({ + serverData, + type: "graph", + resModel: "foo", + context: { fill_temporal: false }, + mockRPC: function (route, args) { + if (args.method === "web_read_group") { + assert.strictEqual( + args.kwargs.context.fill_temporal, + false, + "The observal state of fill_temporal should be false" + ); + } + }, + }); + }); });