[16.0] web_domain_field problem with standard project.task read_group
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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:
- Use a dynamic domain on a project.task field.
- Add that field into a tree view.
- 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.
- 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_timeline: ValueError "Invalid field 'date_start:month'" when grouping by a date fieldPossibly taken @stferraro claimed this today. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 25/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
Similar issues
-
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
-
area/mobile area/ui good first issue
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
natemoo-re/ultrahtml#102 ·