odoo/o-spreadsheet#4305

Created by fw-bot
Merged at c79cd097eec0e55d966b1f377e18cbdff89d4ebb

Statuses:

label
odoo:saas-16.3-16.0-fix-copy-chart-on-deleted-sheet-adrm-WeD9-fw
head
126c34582096275c7c33d8d4a630931cbf9ff0fb
merged
2 years ago by BI, Adrien Minne (adrm)
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

[FW][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

Forward-Port-Of: #4052