[REF] web: remove PieChart

Now that the module web_dashboard has been removed https://github.com/odoo/enterprise/pull/31641,
the component PieChart is unused. We remove it.

closes odoo/odoo#102761

X-original-commit: 3e92c60034cedcd999572bb7e93c8b05ca07be70
Related: odoo/enterprise#32573
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
This commit is contained in:
Mathieu Duckerts-Antoine
2022-10-19 11:11:53 +02:00
parent dcb0498ab8
commit 8c2ec7b4de
3 changed files with 0 additions and 110 deletions
@@ -1,75 +0,0 @@
/** @odoo-module */
import { registry } from "@web/core/registry";
import { View } from "@web/views/view";
import { CallbackRecorder } from "@web/webclient/actions/action_hook";
import { standardWidgetProps } from "../standard_widget_props";
const { Component, useSubEnv } = owl;
export class PieChart extends Component {
setup() {
useSubEnv({
__beforeLeave__: new CallbackRecorder(),
__getGlobalState__: new CallbackRecorder(),
__getLocalState__: new CallbackRecorder(),
__getContext__: new CallbackRecorder(),
__getOrderBy__: new CallbackRecorder(),
config: { ...this.env.config, views: [] },
});
}
get viewProps() {
const { groupBy, measure, record } = this.props;
const { fields, resId, resModel } = record;
const context = { ...record.context };
delete context.graph_mode;
delete context.graph_measure;
delete context.graph_groupbys;
const { comparison, domain } = this.env.searchModel;
const measureField = `<field name="${measure}" type="measure"/>`;
const arch = `
<graph type="pie">
<field name="${groupBy.name}" interval="${groupBy.interval}"/>
${measure ? measureField : ""}
</graph>`;
return {
type: "graph",
resId,
resModel,
fields,
context,
domain,
comparison,
display: { controlPanel: false },
arch,
};
}
}
PieChart.template = "web.PieChart";
PieChart.props = {
...standardWidgetProps,
title: { type: String, optional: true },
groupBy: { type: Object },
measure: { type: String, optional: true },
};
PieChart.extractProps = ({ attrs }) => {
const { groupby, measure } = attrs.modifiers;
return {
title: attrs.title,
groupBy: {
name: groupby.split(":")[0],
interval: groupby.split(":")[1] || "",
},
measure,
};
};
PieChart.components = {
View,
};
registry.category("view_widgets").add("pie_chart", PieChart);
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<template>
<t t-name="web.PieChart" owl="1">
<label t-if="props.title" t-esc="props.title"/>
<View t-props="viewProps"/>
</t>
</template>
@@ -11213,32 +11213,6 @@ QUnit.module("Views", (hooks) => {
}
);
QUnit.test("reload a form view with a pie chart does not crash", async function (assert) {
await makeView({
type: "form",
resModel: "partner",
serverData,
arch: `
<form>
<widget name="pie_chart" title="qux by product" attrs="{'measure': 'qux', 'groupby': 'product_id'}"/>
</form>`,
resIds: [1, 2],
resId: 1,
});
assert.containsOnce(
target,
".o_widget_pie_chart .o_graph_canvas_container .chartjs-render-monitor"
);
await click(target.querySelector(".o_pager_next"));
assert.containsOnce(
target,
".o_widget_pie_chart .o_graph_canvas_container .chartjs-render-monitor"
);
});
QUnit.test("Auto save: save when page changed", async function (assert) {
assert.expect(10);