odoo/o-spreadsheet#4052

Created by BI, Adrien Minne (adrm)
Merged at b4e8a98a3fbdfe01d44738d9bc467d5453018c67

Statuses:

label
odoo:16.0-fix-copy-chart-on-deleted-sheet-adrm
head
c762f2b6f5c43635a6c8852864278a2f605f12ac
merged
2 years ago by BI, Rémi Rahir (rar)
odoo/o-spreadsheet
saas-16.3 #4305
15.0
saas-16.4 #4307
16.0 #4052
17.0 #4314
saas-17.1 #4315
18.0
saas-17.2 #4317
saas-18.2
saas-18.3
saas-18.4
19.0
saas-19.1
master #4318

[FIX] clipboard: cannot paste chart with deleted ranges

Description

Before this commit, when pasting a chart with ranges in its data/labels that were deleted between the copy and the paste, the clipboard would traceback.

That's because getRangeString crashed when the sheetId does not exist anymore. Fixed it by making the function return a string with an invalidSheetName error rather than crashing.

Also replace the uses of getRangeString with getValidRangeString,
which will return undefined for invalid ranges so the typing forces us
to handle it properly.

Task: : 3618758

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