[19.0] web_timeline: ValueError "Invalid field 'date_start:month'" when grouping by a date field
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- frontend
Research direction
Start with static/src/views/timeline/timeline_model.esm.js, especially load() and _event_data_transform(), and compare the group-by values sent to search_read with the grouping formats those methods handle. Reproduce the reported case by grouping a timeline by a date field with a granularity. Done means the view no longer crashes and either groups by the date period or falls back to its default group-by; linked pull request #3808 is already open.
Written by the indexing model from the issue text.
Description
Module
web_timeline (19.0)
Describe the bug
When a timeline view is open and the user groups by a date/datetime field from the search panel (e.g. Start Date > Month), the view crashes with a server error.
To Reproduce
Affected versions: 19.0
Steps to reproduce the behavior:
- Install
web_timelineand open a model that has a timeline view (e.g.project.project/project.task). - Switch to the Timeline view.
- In the search panel, choose Group By > Start Date > Month (any date field and any granularity).
- See error.
Expected behavior
The view should not crash. Either the records are grouped by the date period, or unsupported group-bys are ignored and the default group-by is used.
Traceback
ValueError: Invalid field 'date_start:month' on 'project.project'
File "odoo/orm/models.py", line 5795, in search_read
File "odoo/orm/models.py", line 1429, in search_fetch
File "odoo/orm/models.py", line 3859, in _determine_fields_to_fetch
Cause
In static/src/views/timeline/timeline_model.esm.js, load() copies searchParams.groupBy as is into the fields list sent to search_read:
this.last_group_bys = searchParams.groupBy; // ["date_start:month"]
fields = [...new Set(fields.concat(this.last_group_bys))];
Odoo 19 sends date group-bys with a granularity suffix (field:month, field:week, ...), which is not a valid field name for search_read.
Also, _event_data_transform() builds groups with record[field][0], so only many2one/many2many group-bys are actually supported.
Related
#3518 ([18.0] Multi group by) includes a commit that adds support for grouping by date/datetime with granularity, but it is still open and targets 18.0.
Possible minimal fix
Strip the granularity and ignore non-relational group-bys, falling back to default_group_by:
const groupBy = (searchParams.groupBy || [])
.map((g) => g.split(":")[0])
.filter((g) => ["many2one", "many2many"].includes(this.fields[g]?.type));
this.last_group_bys = groupBy.length
? groupBy
: this.params.default_group_by.split(",");
Happy to open a PR with this fix if maintainers agree, or to help forward-port the date grouping from #3518 once it is merged.
- #2367 reported the same bug on 15.0 but was closed by the stale bot without a fix.
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 2.2k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 30
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OCA/web
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
[19.0] web_m2x_options: system parameter + m2o options not working properly when no recordsPossibly taken @CristhianAC claimed this 11 days ago. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 58/100
Maintainers usually reply within 1 day
-
Migration to version 20.0Possibly taken A pull request linked to this issue is open or already merged. Openhelp wanted no stale work in progress
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 1-2 days Newbie friendliness 45/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 20/100
Maintainers usually reply within 1 day
Similar issues
-
check:passed feeds:add
Difficulty 1/5 Under an hour Newbie friendliness 66/100
-
Wallet functions throws TypeError when the wallet has no account IDPossibly taken @Medhansh-741 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
hiero-ledger/hiero-sdk-js#4781 · 1 comment ·
Maintainers usually reply within 1 day
-
bug package:workers-shared
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cloudflare/workers-sdk#16924 · 1 comment ·
Maintainers usually reply within 1 day
-
dashboard
Difficulty 2/5 Half a day Newbie friendliness 78/100
damodharg6/payledger#9 ·
-
parse: child keys like `007`, `1e3`, `0x1f`, `-1` make the parent an empty array and hide the valueOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100