odoo/o-spreadsheet#7471

Created by BI, Dhrutik Patel (dhrp)

Blocked

label
odoo:19.0-fix-border-lost-after-refresh-dhrp
head
4e27d00b421af856ba70296498f2dbbb2154aaa5
odoo/o-spreadsheet
19.0 #7471 missing r+
master

[FIX] borders: preserve side borders when combining External and All

Description:

When applying an External border on a range and then applying All borders on an inner/overlapping range, the side borders (left/right) of the inner cells were lost after re-opening the spreadsheet.

The exported border data was correct, but the BordersPlugin recomputation logic in addBorder incorrectly cleared adjacent borders on import/update. The adjacency check (adjacent(existingBorder.zone, zone)) reported the side of the existing zone, but we were deciding whether to clear it based on the same side key in the new border, instead of the opposite side (shared edge) on the new zone. As a result, importing the combination of:

C2:C4 with All borders
B2:B4 with left/top/bottom
D2:D4 with right/top/bottom

ended up clearing the left and right borders of C2:C4.

This PR adjusts the adjacent clearing logic to:

Map the adjacent side of the existing zone to the opposite side on the new zone.

Only clear the existing side if the corresponding opposite side is actually being written on the new border.

Task: 5270171

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