odoo/o-spreadsheet#4307

Created by fw-bot
Merged at 378b95bde05777bb5bd4e0b2a3db54389667cd5b

Statuses:

label
odoo:saas-16.4-16.0-fix-copy-chart-on-deleted-sheet-adrm-HVwi-fw
head
6fa16dd41db760a1959d87097e4bc001f15d0f27
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: #4305
Forward-Port-Of: #4052