From 093b2f56fb61c6fc01837b775a49c015c76a6d35 Mon Sep 17 00:00:00 2001 From: nikj-odoo Date: Fri, 25 Aug 2023 09:29:18 +0000 Subject: [PATCH] [FIX] web,sale: Add domain & show action helper when there is no data In this commit, show action helper when we had not data show in graph view. same as we have in pivot view. - add domain for cancelled records to not showing in reporting. task-3500508 closes odoo/odoo#137735 X-original-commit: a50e73a2ae04fac9fcfea77cbab27e0b5de66fcc Related: odoo/enterprise#48473 Signed-off-by: Victor Feyens (vfe) --- addons/sale/report/sale_report_views.xml | 1 + .../src/views/graph/graph_controller.xml | 2 +- .../static/tests/views/graph_view_tests.js | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/addons/sale/report/sale_report_views.xml b/addons/sale/report/sale_report_views.xml index da8076b4787..03dfc64fbef 100644 --- a/addons/sale/report/sale_report_views.xml +++ b/addons/sale/report/sale_report_views.xml @@ -100,6 +100,7 @@ graph,pivot + [('state', '!=', 'cancel')] {'search_default_Sales':1, 'group_by_no_leaf':1,'group_by':[], 'search_default_filter_order_date': 1} This report performs analysis on your quotations and sales orders. Analysis check your sales revenues and sort it by different group criteria (salesman, partner, product, etc.) Use this report to perform analysis on sales not having invoiced yet. If you want to analyse your turnover, you should use the Invoice Analysis report in the Accounting application. diff --git a/addons/web/static/src/views/graph/graph_controller.xml b/addons/web/static/src/views/graph/graph_controller.xml index e9b0655ec04..b4c8bbe07aa 100644 --- a/addons/web/static/src/views/graph/graph_controller.xml +++ b/addons/web/static/src/views/graph/graph_controller.xml @@ -63,7 +63,7 @@ - + diff --git a/addons/web/static/tests/views/graph_view_tests.js b/addons/web/static/tests/views/graph_view_tests.js index 7660416eaee..5af4602debe 100644 --- a/addons/web/static/tests/views/graph_view_tests.js +++ b/addons/web/static/tests/views/graph_view_tests.js @@ -3693,7 +3693,24 @@ QUnit.module("Views", (hooks) => { assert.doesNotHaveClass(target, "o_view_sample_data"); assert.containsOnce(target, ".o_graph_canvas_container canvas"); - assert.containsNone(target, ".o_view_nocontent"); + assert.containsOnce(target, ".o_view_nocontent"); + }); + + QUnit.test("empty graph view without sample data after filter", async function (assert) { + await makeView({ + serverData, + type: "graph", + resModel: "foo", + arch: ` + + + + `, + domain: Domain.FALSE.toList(), + noContentHelp: '

click to add a foo

', + }); + assert.containsOnce(target, ".o_graph_canvas_container canvas"); + assert.containsOnce(target, ".o_view_nocontent"); }); QUnit.test("reload chart with switchView button keep internal state", async function (assert) {