odoo/o-spreadsheet#7714
Created by BI, Dhrutik Patel (dhrp)
Merged
at 4a7fae87d68b09b1aed81cd13ca819a770f6e1d1
Statuses:
- label
- odoo:19.0-fix-pivot-running-total-dhrp
- head
- 2d6211dd41480028311135649451f65ade241920
- merged
- 2 days ago by BI, Lucas Lefèvre (lul)
| odoo/o-spreadsheet | |
|---|---|
| master | #7714 |
[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