[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) <aab@odoo.com>
This commit is contained in:
Simon Genin (ges)
2021-09-29 07:12:24 +00:00
parent dd47708f5f
commit b6be398743
2 changed files with 40 additions and 1 deletions
@@ -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 = [];
@@ -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"
);
}
},
});
});
});