[19.0] web_timeline: ValueError "Invalid field 'date_start:month'" when grouping by a date field

Aperta
#3,807 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@stferraro ci sta già lavorando.

Dal 13/11/2026.

  • #3808 di @stferraro — aperta

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

bug
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:

  1. Install web_timeline and open a model that has a timeline view (e.g. project.project / project.task).
  2. Switch to the Timeline view.
  3. In the search panel, choose Group By > Start Date > Month (any date field and any granularity).
  4. 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.

Captura de pantalla 2026-11-13 a la(s) 6 01 19 p  m
  • #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

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OCA/web

Tutte le issue di OCA/web

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.