odoo/o-spreadsheet#7249

Created by BI, Adrien Minne (adrm)

Blocked

label
odoo:19.0-fix-smart-chart-engine-adrm
head
92d88a7bb0f2a8a001ae19148438453ae891651d
odoo/o-spreadsheet
19.0 #7249 missing r+
master

[FIX] charts: fix smart chart engine

Description

We have a "Smart chart engine" that automatically suggests a chart type and configuration based on the selected data. There were a bunch of issues with it:

  • some selected columns were sometime missing from the chart definition
  • the chart created was sometime empty
  • the order of the selected columns has totally ignored, leading to some strange definitions with a dataset [col1, col3] and labels on col2
  • we used a createBaseChart helper that casted an object into a ChartDefinition, skipping the typing and leading to wrong chart definitions with missing properties.
  • some rules were strange or inconsistent

This commit fixes those issues, making the rules simpler and more consistent, while adding some docstring to explain the desired behavior.

Task: 5079093

review checklist

  • [ ] feature is organized in plugin, or UI components
  • [ ] support of duplicate sheet (deep copy)
  • [ ] in model/core: ranges are Range object, and can be adapted (adaptRanges)
  • [ ] in model/UI: ranges are strings (to show the user)
  • [ ] undo-able commands (uses this.history.update)
  • [ ] multiuser-able commands (has inverse commands and transformations where needed)
  • [ ] new/updated/removed commands are documented
  • [ ] exportable in excel
  • [ ] translations (_t("qmsdf %s", abc))
  • [ ] unit tested
  • [ ] clean commented code
  • [ ] track breaking changes
  • [ ] doc is rebuild (npm run doc)
  • [ ] status is correct in Odoo