[19.0] web_timeline: ValueError "Invalid field 'date_start:month'" when grouping by a date field
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- frontend
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- JavaScript
- Stelle
- 1.2k
- Fork
- 2.2k
- Merge medio
- 3g 15h
- PR unite (30g)
- 30
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OCA/web
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
[19.0] web_m2x_options: system parameter + m2o options not working properly when no recordsForse già presa @CristhianAC l’ha presa 11 giorni fa. Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
I maintainer di solito rispondono entro 1 giorno
-
Migration to version 20.0Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertahelp wanted no stale work in progress
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 4/5 1-2 giorni Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
[workshop-sim] Improve: Provide a concrete example and activity checks in agentic intro (step 5)Apertafeedback simulation workshop
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
githubnext/gh-aw-workshop#5715 ·
I maintainer di solito rispondono entro 1 giorno
-
[prefer-expect-resolves] autofix leaves a stray ")" when the awaited expression is parenthesizedAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jest-community/eslint-plugin-jest#2052 ·
-
Add: FILMBOX+ Festival FeedApertacheck:passed feeds:add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 66/100
-
Wallet functions throws TypeError when the wallet has no account IDForse già presa @Medhansh-741 l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
hiero-ledger/hiero-sdk-js#4781 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100