odoo/o-spreadsheet#7714

Created by BI, Dhrutik Patel (dhrp)

Blocked

label
odoo:19.0-fix-pivot-running-total-dhrp
head
4e455efe60851d8f17a757f5a74f298e887b480e
odoo/o-spreadsheet
19.0 #7714 missing r+
saas-19.1
master

[FIX] pivot: carry forward running totals for missing date buckets

Description:

When a measure is displayed as "running total" and the pivot is grouped by a date granularity (month/day/etc), PIVOT.VALUE returned an empty value for a requested bucket that does not exist in the pivot. This happened because the running-total cache only stores values for materialized pivot buckets, so a missing date key had no direct lookup.

With this commit, for date/datetime dimensions, we build an ordered index of existing buckets per secondary domain and running-total group, and use a binary search to find the nearest previous bucket. If found, we return its cumulative value (carry-forward); if the requested bucket is before the first one, we return empty.

Task: 5420999

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