[16.0] web_domain_field problem with standard project.task read_group

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

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

The issue identifies web_domain_field and the overridden project.task read_group as the relevant entry points. Read the domain serialization and read_group handling, then reproduce by grouping a tree view using a field with the dynamic true domain (1, '=', 1). Done means grouping works without treating 1 as a field name; the issue does not name a test file.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Module

Web Domain Field - web_domain_field

Describe the bug

Odoo standard project task has read_group overridden and loops on domains. When we create a true domain (1, '=', 1) with web_domain_field it is created as [1, '=', 1], so it's not recognised as true leaf by odoo osv, causing this overridden read_group to try splitting "1" like a field name.

To Reproduce

16.0:

Steps to reproduce the behavior:

  1. Use a dynamic domain on a project.task field.
  2. Add that field into a tree view.
  3. Try to group by.

Expected behavior
Right now I cannot see a proper solution for this other than overridding the read_group on project.task like this:

@api.model
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
    fields_list = ([f.split(':')[0] for f in fields] or [])
    if groupby:
        fields_groupby = [groupby] if isinstance(groupby, str) else groupby
        # only take field name when having ':' e.g 'date_deadline:week' => 'date_deadline'
        fields_list += [f.split(':')[0] for f in fields_groupby]
    if domain:
        for term in domain:
            if isinstance(term, (tuple, list)) and term not in [expression.TRUE_LEAF, expression.FALSE_LEAF, [1, '=', 1]]:
                fields_list += [term[0].split('.')[0]]
    self._ensure_fields_are_accessible(fields_list)
    return super(models.Model, self).read_group(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=lazy)

Watch how [1, '=', 1] is excluded for parsing and then the models.Model super read_group is called.

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.