Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0] web_domain_field problem with standard project.task read_group #3111

Open
aalonso-liderit opened this issue Feb 28, 2025 · 0 comments
Labels

Comments

@aalonso-liderit
Copy link

aalonso-liderit commented Feb 28, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant