odoo/o-spreadsheet#7379

Created by BI, Rémi Rahir (rar)

Blocked

label
odoo:saas-18.3-fix-missing-chart-deps-rar
head
2519ef5b1c1a763a059f87c64f365d0dcc51dee0
odoo/o-spreadsheet
saas-18.3 #7379 missing r+
saas-18.4
19.0
master

[FIX] Charts: Ensure Chart js extension are loaded on chart creation

When calling the method chartToImage, the chartJs extensions might not be loaded as we load them conditionally when mounting a chart. Hence, calling ChartToImage when there are no visible charts in the viewport or if we just instantiate a model without loading a component Spreadsheet, the extensions will be missing.

Right now, the plugins/extensions are not fundamental to convert a chart to an image but this becomes problematic with the arrival of future charts (for instance Funnel).

This commit adds a check to ensure that the extensisons are loaded and unloads them after use as they can cause crashes when using the global ChartJs variable elsewhere (see #6076).

task-5214007

Description:

description of this task, what is implemented and why it is implemented that way.

Task: TASK_ID

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