From 53f6a2e5118363bbef518f381ad90687ab7c14fa Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Fri, 6 Nov 2026 22:28:02 -0500 Subject: [PATCH 1/3] [FIX] spreadsheet_oca: build 20.0 chart definitions, not odoo_* types Inserting a graph view into a spreadsheet raised "Cannot find odoo_pie in this registry!" and nothing was created. 20.0 removed the `odoo_bar` / `odoo_line` / `odoo_pie` chart types. A chart now carries the plain o-spreadsheet type and names Odoo as its data source, which is also where metaData, searchParams, cumulatedStart and actionXmlId moved -- core's own 19.3.10 migration step rewrites stored definitions the same way. chartTypeRegistry only knows the plain keys, so the 19.0-shaped `odoo_${mode}` threw on CREATE_CHART. metaData.mode is deliberately not passed on: ChartDataSource derives the GraphModel mode from the chart type. The rest of the definition is trimmed to each type's allowedDefinitionKeys. 20.0 dropped `verticalAxisPosition` and `axisType` from bar/line/pie, allows `stacked` only on bar and line, and `cumulative` only on line. Unknown keys are deleted without a word, so leaving them in only wrote dead state into the saved payload. Signed-off-by: Don Kendall Assisted-by: Claude Opus 5 --- .../bundle/spreadsheet_action.esm.js | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_action.esm.js b/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_action.esm.js index e127dca5..4889df1a 100644 --- a/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_action.esm.js +++ b/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet_action.esm.js @@ -112,22 +112,32 @@ export class ActionSpreadsheetOca extends Component { // TODO: Add a way to detect the last row total height } const dataSourceId = uuidGenerator.uuidv4(); - const chartType = `odoo_${this.import_data.metaData.mode}`; + // 20.0 dropped the `odoo_*` chart types: the chart now carries the plain + // o-spreadsheet type and names Odoo as its data source. `metaData.mode` is + // no longer stored either -- ChartDataSource derives it from `type`. + const chartType = this.import_data.metaData.mode; const definition = { title: {text: this.import_data.name}, type: chartType, - fillArea: chartType === "odoo_line", background: "#FFFFFF", - stacked: this.import_data.metaData.stacked, - axisType: this.import_data.metaData.axisType, - metaData: this.import_data.metaData, - searchParams: this.cleanSearchParams(), - cumulative: this.import_data.metaData.cumulated, - cumulatedStart: this.import_data.metaData.cumulatedStart, legendPosition: "top", - verticalAxisPosition: "left", - actionXmlId: this.import_data.actionXmlId, + dataSource: { + type: "odoo", + metaData: this.import_data.metaData, + searchParams: this.cleanSearchParams(), + cumulatedStart: this.import_data.metaData.cumulatedStart, + actionXmlId: this.import_data.actionXmlId, + }, }; + // Keys outside a chart type's `allowedDefinitionKeys` are dropped without + // a word, so only set the ones that type accepts. + if (chartType === "bar" || chartType === "line") { + definition.stacked = this.import_data.metaData.stacked; + } + if (chartType === "line") { + definition.fillArea = true; + definition.cumulative = this.import_data.metaData.cumulated; + } spreadsheet_model.dispatch("CREATE_CHART", { sheetId, figureId: uuidGenerator.uuidv4(), From 3cb08730a6d77fcaecd8c0ec86d8ff86ca473bbb Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Fri, 6 Nov 2026 22:28:24 -0500 Subject: [PATCH 2/3] [FIX] spreadsheet_oca: port the chart Odoo-menu link to the 20.0 API Opening any chart's side panel threw "getChartOdooMenu is not a function". The "Link to Odoo menu" section is extended into core's Generic, Bar, Line, Gauge and Scorecard config panels, so this hit every chart, not just the Odoo-sourced ones. 20.0 generalised the chart-to-menu reference into a chart-to-Odoo link that can point at either a menu or a data source: the getter is getChartOdooLink and returns the link record, and the command is UPDATE_ODOO_LINK_TO_CHART taking `odooLink`, where clearing it is `undefined` rather than a false id. getChartOdooLink already drops a link whose menu no longer resolves, but it can also return a "dataSource" link, so the type is checked before reading odooMenuId. Signed-off-by: Don Kendall Assisted-by: Claude Opus 5 --- .../src/spreadsheet/bundle/chart_panels.esm.js | 17 +++++++++-------- .../src/spreadsheet/bundle/odoo_panels.esm.js | 17 +++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/spreadsheet_oca/static/src/spreadsheet/bundle/chart_panels.esm.js b/spreadsheet_oca/static/src/spreadsheet/bundle/chart_panels.esm.js index a8d18e67..5a6d5cbf 100644 --- a/spreadsheet_oca/static/src/spreadsheet/bundle/chart_panels.esm.js +++ b/spreadsheet_oca/static/src/spreadsheet/bundle/chart_panels.esm.js @@ -38,24 +38,25 @@ const menuChartProps = () => ({ return [["id", "in", menus]]; }, get menuId() { - const menu = this.env.model.getters.getChartOdooMenu(this.props.chartId); - if (menu) { - return [menu.id, menu.name]; + const odooLink = this.env.model.getters.getChartOdooLink(this.props.chartId); + if (odooLink?.type !== "odooMenu") { + return false; } - return false; + const menu = this.env.model.getters.getIrMenu(odooLink.odooMenuId); + return menu ? [menu.id, menu.name] : false; }, updateMenu(menuId) { if (!menuId) { - this.env.model.dispatch("LINK_ODOO_MENU_TO_CHART", { + this.env.model.dispatch("UPDATE_ODOO_LINK_TO_CHART", { chartId: this.props.chartId, - odooMenuId: false, + odooLink: undefined, }); return; } const menu = this.env.model.getters.getIrMenu(menuId[0].id); - this.env.model.dispatch("LINK_ODOO_MENU_TO_CHART", { + this.env.model.dispatch("UPDATE_ODOO_LINK_TO_CHART", { chartId: this.props.chartId, - odooMenuId: menu.xmlid || menu.id, + odooLink: {type: "odooMenu", odooMenuId: menu.xmlid || menu.id}, }); }, get record() { diff --git a/spreadsheet_oca/static/src/spreadsheet/bundle/odoo_panels.esm.js b/spreadsheet_oca/static/src/spreadsheet/bundle/odoo_panels.esm.js index 10c11c0f..9e1ad99a 100644 --- a/spreadsheet_oca/static/src/spreadsheet/bundle/odoo_panels.esm.js +++ b/spreadsheet_oca/static/src/spreadsheet/bundle/odoo_panels.esm.js @@ -47,24 +47,25 @@ export class OdooPanel extends Component { return this.props.chartId; } get menuId() { - const menu = this.env.model.getters.getChartOdooMenu(this.chartId); - if (menu) { - return [menu.id, menu.name]; + const odooLink = this.env.model.getters.getChartOdooLink(this.chartId); + if (odooLink?.type !== "odooMenu") { + return false; } - return false; + const menu = this.env.model.getters.getIrMenu(odooLink.odooMenuId); + return menu ? [menu.id, menu.name] : false; } updateMenu(menuId) { if (!menuId) { - this.env.model.dispatch("LINK_ODOO_MENU_TO_CHART", { + this.env.model.dispatch("UPDATE_ODOO_LINK_TO_CHART", { chartId: this.chartId, - odooMenuId: false, + odooLink: undefined, }); return; } const menu = this.env.model.getters.getIrMenu(menuId[0].id); - this.env.model.dispatch("LINK_ODOO_MENU_TO_CHART", { + this.env.model.dispatch("UPDATE_ODOO_LINK_TO_CHART", { chartId: this.chartId, - odooMenuId: menu.xmlid || menu.id, + odooLink: {type: "odooMenu", odooMenuId: menu.xmlid || menu.id}, }); } get record() { From 688a4a8176f650abfae3de0a9e3dc8287502e1fa Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Fri, 6 Nov 2026 22:46:10 -0500 Subject: [PATCH 3/3] [FIX] spreadsheet_oca: register the Odoo chart data-source side panel Editing any Odoo-sourced chart threw "Cannot find odoo in this registry!" from ChartDataSourceComponent, so the whole chart side panel failed to render and the dialog was an "Oops!". 20.0 split the chart side panel: the generic part stays keyed by chart type, while the data-source section is delegated to a component looked up in chartDataSourceSidePanelComponentRegistry by `dataSource.type`. Core ships only "range" -- the Odoo entry was an Enterprise one -- so nothing answered for "odoo". This is the 20.0 home for what the module used to register as chartSidePanelComponentRegistry entries under `odoo_bar` / `odoo_pie` / ..., keys that no longer exist. An Odoo chart has no ranges for the user to pick, so the section names the view the chart reads from instead. Signed-off-by: Don Kendall Assisted-by: Claude Opus 5 --- .../src/spreadsheet/bundle/odoo_panels.esm.js | 21 ++++++++++++++++++- .../src/spreadsheet/bundle/spreadsheet.xml | 6 ++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/spreadsheet_oca/static/src/spreadsheet/bundle/odoo_panels.esm.js b/spreadsheet_oca/static/src/spreadsheet/bundle/odoo_panels.esm.js index 9e1ad99a..c1ab0b08 100644 --- a/spreadsheet_oca/static/src/spreadsheet/bundle/odoo_panels.esm.js +++ b/spreadsheet_oca/static/src/spreadsheet/bundle/odoo_panels.esm.js @@ -5,7 +5,8 @@ import {Many2XAutocomplete} from "@web/views/fields/relational_utils"; import {_t} from "@web/core/l10n/translation"; import {useService} from "@web/core/utils/hooks"; -const {chartSidePanelComponentRegistry} = spreadsheet.registries; +const {chartSidePanelComponentRegistry, chartDataSourceSidePanelComponentRegistry} = + spreadsheet.registries; const { PieChartDesignPanel, ChartWithAxisDesignPanel, @@ -19,6 +20,24 @@ const { } = spreadsheet.components; const {Component, useProps} = owl; +/** + * Data-source section of the chart side panel for charts fed by an Odoo view. + * + * Core only registers "range", whose section lets you pick the cell ranges. An + * Odoo chart has none to pick -- its data comes from the view it was inserted + * from -- so this names that view instead. + */ +export class OdooChartDataSourcePanel extends Component { + props = useProps(); + + get resModel() { + return this.props.dataSource?.metaData?.resModel || ""; + } +} +OdooChartDataSourcePanel.template = "spreadsheet_oca.OdooChartDataSourcePanel"; + +chartDataSourceSidePanelComponentRegistry.add("odoo", OdooChartDataSourcePanel); + export class OdooPanel extends Component { props = useProps(); diff --git a/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml b/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml index 42d68cf0..5242fa16 100644 --- a/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml +++ b/spreadsheet_oca/static/src/spreadsheet/bundle/spreadsheet.xml @@ -584,6 +584,12 @@ + +
+
Data source
+
+
+
Link to Odoo menu