[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) <vfe@odoo.com>
This commit is contained in:
nikj-odoo
2023-10-06 06:14:13 +00:00
parent dc3a0994b4
commit 093b2f56fb
3 changed files with 20 additions and 2 deletions
+1
View File
@@ -100,6 +100,7 @@
<field name="view_mode">graph,pivot</field>
<field name="view_id"></field> <!-- force empty -->
<field name="search_view_id" ref="view_order_product_search"/>
<field name="domain">[('state', '!=', 'cancel')]</field>
<field name="context">{'search_default_Sales':1, 'group_by_no_leaf':1,'group_by':[], 'search_default_filter_order_date': 1}</field>
<field name="help">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.</field>
</record>
@@ -63,7 +63,7 @@
<t t-component="searchBarToggler.component" t-props="searchBarToggler.props"/>
</t>
<t t-if="model.data">
<t t-if="model.useSampleModel and props.info.noContentHelp" t-call="web.ActionHelper">
<t t-if="!model.hasData() or model.useSampleModel and props.info.noContentHelp" t-call="web.ActionHelper">
<t t-set="noContentHelp" t-value="props.info.noContentHelp"/>
</t>
<t t-component="props.Renderer" model="model" buttonTemplate="props.buttonTemplate" />
@@ -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: `
<graph>
<field name="date"/>
</graph>
`,
domain: Domain.FALSE.toList(),
noContentHelp: '<p class="abc">click to add a foo</p>',
});
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) {