Daily updates from Odoo
Friday, April 6, 2018
1 change
Resolved issues and error corrections
This fixes an issue where combining multiple search filters could produce incorrect results when some filters used shorthand logic. The change makes Odoo normalize filters before combining them, helping developers avoid subtle errors and ensuring users see the intended records.
Original PR description
Before this rev: * Take 2 domains that contain at least two leaves, and at least one of them must use the implicit `&` operator e.g.: ```python d1 = [('so_line', 'in', [91]), ('amount', '<=', 0.0)]…
Before this rev:
* Take 2 domains that contain at least two leaves, and at least one of
them must use the implicit `&` operator
e.g.:
```python
d1 = [('so_line', 'in', [91]), ('amount', '<=', 0.0)]
d2 = ['&', ('so_line', 'in', []), ('project_id', '!=', False)]
```
* Perform osv.expression.OR() between both domains
Expected result:
```python
d3 = ['|', d1, d2]
```
Actual result (after normalization):
```
d3 = ['&', '|', d1, d2]
```
This is because, since the `&` is implicit for the first domain, when we
OR it, we give it an explicit `|` operator, so when we pass this domain
through the normalize_domain function, d1 no longer contains an implicit
`&` operator but instead the implicit operator is the one between d1 and
d2, therefore giving us a completely wrong domain.
The `combine` function states that it only accepts normalized domains,
however neither the OR nor AND functions do, this leads to a lot of
developers putting non-normalized domains into these functions, and
there's no error checking or anything that obviously indicates that the
domain is incorrect, so we might as well normalize all domains being
passed since it's already pretty optimized.
Task-ID: 1833909