From 8c2ec7b4de7ec9d3481ec9a6ef6ee7cbf6b37844 Mon Sep 17 00:00:00 2001 From: Mathieu Duckerts-Antoine Date: Fri, 7 Oct 2022 14:55:27 +0000 Subject: [PATCH] [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) Signed-off-by: Mathieu Duckerts-Antoine --- .../src/views/widgets/pie_chart/pie_chart.js | 75 ------------------- .../src/views/widgets/pie_chart/pie_chart.xml | 9 --- .../tests/views/form/form_view_tests.js | 26 ------- 3 files changed, 110 deletions(-) delete mode 100644 addons/web/static/src/views/widgets/pie_chart/pie_chart.js delete mode 100644 addons/web/static/src/views/widgets/pie_chart/pie_chart.xml diff --git a/addons/web/static/src/views/widgets/pie_chart/pie_chart.js b/addons/web/static/src/views/widgets/pie_chart/pie_chart.js deleted file mode 100644 index 3644718e7de..00000000000 --- a/addons/web/static/src/views/widgets/pie_chart/pie_chart.js +++ /dev/null @@ -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 = ``; - const arch = ` - - - ${measure ? measureField : ""} - `; - 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); diff --git a/addons/web/static/src/views/widgets/pie_chart/pie_chart.xml b/addons/web/static/src/views/widgets/pie_chart/pie_chart.xml deleted file mode 100644 index bd43fc5cf08..00000000000 --- a/addons/web/static/src/views/widgets/pie_chart/pie_chart.xml +++ /dev/null @@ -1,9 +0,0 @@ - - diff --git a/addons/web/static/tests/views/form/form_view_tests.js b/addons/web/static/tests/views/form/form_view_tests.js index 1d87e4b852c..ef5e5b2a337 100644 --- a/addons/web/static/tests/views/form/form_view_tests.js +++ b/addons/web/static/tests/views/form/form_view_tests.js @@ -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: ` -
- - `, - 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);