<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Odoo/odoo/osv/expression.py, branch 14.0</title>
<subtitle>The current checkout of upstream Odoo</subtitle>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/'/>
<entry>
<title>[FIX] expression: Better Binaries logs</title>
<updated>2021-05-12T06:48:59+00:00</updated>
<author>
<name>Jérôme Vanhaudenard</name>
<email>jev@odoo.com</email>
</author>
<published>2021-05-11T12:35:43+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=0ed46ae94b20b30c10025b2a458e1ecf92c2712d'/>
<id>0ed46ae94b20b30c10025b2a458e1ecf92c2712d</id>
<content type='text'>
When building a domain `(=|!=)` with
a Binary field stored in attachment and
the right part of the domain is not null,
the full binary content is logged, giving
the logs a huge size.

Now, the content of the binary is cropped to
20 chars as it is useless to log more.

opw-2527629

closes odoo/odoo#70699

X-original-commit: d54b30bb7feed52de86f4302dc4a01f2d4009782
Signed-off-by: Xavier Dollé (xdo) &lt;xdo@odoo.com&gt;
Signed-off-by: Raphael Collet (rco) &lt;rco@openerp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When building a domain `(=|!=)` with
a Binary field stored in attachment and
the right part of the domain is not null,
the full binary content is logged, giving
the logs a huge size.

Now, the content of the binary is cropped to
20 chars as it is useless to log more.

opw-2527629

closes odoo/odoo#70699

X-original-commit: d54b30bb7feed52de86f4302dc4a01f2d4009782
Signed-off-by: Xavier Dollé (xdo) &lt;xdo@odoo.com&gt;
Signed-off-by: Raphael Collet (rco) &lt;rco@openerp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] core/expression: fix distribute_not over thruty leafs</title>
<updated>2021-04-01T15:30:21+00:00</updated>
<author>
<name>Alvaro Fuentes</name>
<email>afu@odoo.com</email>
</author>
<published>2021-03-31T15:45:49+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=26976764554af3016097f1659b563e75757148e3'/>
<id>26976764554af3016097f1659b563e75757148e3</id>
<content type='text'>
A domain with a negated thruty leaf raises an exception here
https://github.com/odoo/odoo/blob/835197e48fbbee1c8ac35d52287537fa6f0bdd36/odoo/osv/expression.py#L614
due to
https://github.com/odoo/odoo/blob/835197e48fbbee1c8ac35d52287537fa6f0bdd36/odoo/osv/expression.py#L670
and the fact that `FALSE_LEAF != (1, "!=", 1)` and `TRUE_LEAF != (0, "!=", 1)`

Current wrong behaviour:
```
&gt;&gt;&gt; distribute_not(['!', TRUE_LEAF])
[(1, '!=', 1)]
&gt;&gt;&gt; is_leaf((1, '!=', 1))
False
```

This issue was noticed when adapting domains for fields that have been
removed during migration. Example (extract of) traceback:
```
Traceback (most recent call last):
  File "/home/odoo/src/odoo/13.0/odoo/http.py", line 624, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  ...
  File "/home/odoo/src/odoo/13.0/odoo/osv/expression.py", line 677, in __init__
    self.parse()
  File "/home/odoo/src/odoo/13.0/odoo/osv/expression.py", line 814, in parse
    self.stack = [ExtendedLeaf(leaf, self.root_model) for leaf in self.expression]
  File "/home/odoo/src/odoo/13.0/odoo/osv/expression.py", line 814, in &lt;listcomp&gt;
    self.stack = [ExtendedLeaf(leaf, self.root_model) for leaf in self.expression]
  File "/home/odoo/src/odoo/13.0/odoo/osv/expression.py", line 562, in __init__
    self.check_leaf(internal)
  File "/home/odoo/src/odoo/13.0/odoo/osv/expression.py", line 618, in check_leaf
    raise ValueError("Invalid leaf %s" % str(self.leaf))
ValueError: Invalid leaf (0, '!=', 1)
```

closes odoo/odoo#68657

X-original-commit: e20c23658d15a135e5f35b0e8dec6e3202cecaab
Signed-off-by: Christophe Simonis &lt;chs@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A domain with a negated thruty leaf raises an exception here
https://github.com/odoo/odoo/blob/835197e48fbbee1c8ac35d52287537fa6f0bdd36/odoo/osv/expression.py#L614
due to
https://github.com/odoo/odoo/blob/835197e48fbbee1c8ac35d52287537fa6f0bdd36/odoo/osv/expression.py#L670
and the fact that `FALSE_LEAF != (1, "!=", 1)` and `TRUE_LEAF != (0, "!=", 1)`

Current wrong behaviour:
```
&gt;&gt;&gt; distribute_not(['!', TRUE_LEAF])
[(1, '!=', 1)]
&gt;&gt;&gt; is_leaf((1, '!=', 1))
False
```

This issue was noticed when adapting domains for fields that have been
removed during migration. Example (extract of) traceback:
```
Traceback (most recent call last):
  File "/home/odoo/src/odoo/13.0/odoo/http.py", line 624, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  ...
  File "/home/odoo/src/odoo/13.0/odoo/osv/expression.py", line 677, in __init__
    self.parse()
  File "/home/odoo/src/odoo/13.0/odoo/osv/expression.py", line 814, in parse
    self.stack = [ExtendedLeaf(leaf, self.root_model) for leaf in self.expression]
  File "/home/odoo/src/odoo/13.0/odoo/osv/expression.py", line 814, in &lt;listcomp&gt;
    self.stack = [ExtendedLeaf(leaf, self.root_model) for leaf in self.expression]
  File "/home/odoo/src/odoo/13.0/odoo/osv/expression.py", line 562, in __init__
    self.check_leaf(internal)
  File "/home/odoo/src/odoo/13.0/odoo/osv/expression.py", line 618, in check_leaf
    raise ValueError("Invalid leaf %s" % str(self.leaf))
ValueError: Invalid leaf (0, '!=', 1)
```

closes odoo/odoo#68657

X-original-commit: e20c23658d15a135e5f35b0e8dec6e3202cecaab
Signed-off-by: Christophe Simonis &lt;chs@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] core: flush() domain returned by search method</title>
<updated>2020-09-17T14:07:26+00:00</updated>
<author>
<name>Raphael Collet</name>
<email>rco@odoo.com</email>
</author>
<published>2020-09-16T12:29:02+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=77ec3b224f3fd6c8ad6dccbbf7612be8464a385d'/>
<id>77ec3b224f3fd6c8ad6dccbbf7612be8464a385d</id>
<content type='text'>
Assume field B depends on A, and searching on B is rewritten as a domain
that mentions A.  If A is modified, and then we search on B, one has to
flush A to the database before searching.

closes odoo/odoo#57958

X-original-commit: b242b7b1382ee39ebefa58c556931b7dae77f669
Signed-off-by: Raphael Collet (rco) &lt;rco@openerp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Assume field B depends on A, and searching on B is rewritten as a domain
that mentions A.  If A is modified, and then we search on B, one has to
flush A to the database before searching.

closes odoo/odoo#57958

X-original-commit: b242b7b1382ee39ebefa58c556931b7dae77f669
Signed-off-by: Raphael Collet (rco) &lt;rco@openerp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] core: add models defined by a query instead of a table/view</title>
<updated>2020-08-20T07:45:18+00:00</updated>
<author>
<name>wan</name>
<email>wan@odoo.com</email>
</author>
<published>2020-08-12T15:29:15+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=f2ceef0e2f0efb2e47b5f595a80009184305a2c4'/>
<id>f2ceef0e2f0efb2e47b5f595a80009184305a2c4</id>
<content type='text'>
By adding a parameter `_table_query` on the Model, we can now have views
that depend on the context.  The query is used instead of the table name
in ORM operations.  This allows to pre-compute some values to improve
performance, instead of storing context values in the database.

Co-authored-by: william-andre &lt;wan@odoo.com&gt;
Co-authored-by: rco-odoo &lt;rco@odoo.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
By adding a parameter `_table_query` on the Model, we can now have views
that depend on the context.  The query is used instead of the table name
in ORM operations.  This allows to pre-compute some values to improve
performance, instead of storing context values in the database.

Co-authored-by: william-andre &lt;wan@odoo.com&gt;
Co-authored-by: rco-odoo &lt;rco@odoo.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] core: introduce subqueries in search</title>
<updated>2020-08-18T13:02:41+00:00</updated>
<author>
<name>Raphael Collet</name>
<email>rco@odoo.com</email>
</author>
<published>2020-06-17T16:48:27+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=69869ab681e2271ae802ca3ab7285ee83580208d'/>
<id>69869ab681e2271ae802ca3ab7285ee83580208d</id>
<content type='text'>
Make the method `_search` return a `Query` object, and make that object
generate a subquery when used on the right-hand side of a condition.

closes odoo/odoo#52403

Related: odoo/enterprise#10945
Signed-off-by: Raphael Collet (rco) &lt;rco@openerp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make the method `_search` return a `Query` object, and make that object
generate a subquery when used on the right-hand side of a condition.

closes odoo/odoo#52403

Related: odoo/enterprise#10945
Signed-off-by: Raphael Collet (rco) &lt;rco@openerp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[REF] core: improve the API and implementation of Query</title>
<updated>2020-08-18T13:02:41+00:00</updated>
<author>
<name>Raphael Collet</name>
<email>rco@odoo.com</email>
</author>
<published>2020-06-17T16:48:00+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=0f7f163d2e2bb9cc38f2b037dae6df2eae9466a4'/>
<id>0f7f163d2e2bb9cc38f2b037dae6df2eae9466a4</id>
<content type='text'>
Introduce better methods for introducing tables, join clauses and where
clauses to the Query object, and other methods to generate a complete
SELECT query.  The Query object can also behave as a tuple of ids, where
the query is made on demand, and the result is memoized.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Introduce better methods for introducing tables, join clauses and where
clauses to the Query object, and other methods to generate a complete
SELECT query.  The Query object can also behave as a tuple of ids, where
the query is made on demand, and the result is memoized.</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] core: use _search() and _name_search() for sub-searches</title>
<updated>2020-08-18T13:02:41+00:00</updated>
<author>
<name>Raphael Collet</name>
<email>rco@odoo.com</email>
</author>
<published>2020-06-17T12:18:29+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=6f87bbbfc8e34b412fe9c129c002269540fa5a30'/>
<id>6f87bbbfc8e34b412fe9c129c002269540fa5a30</id>
<content type='text'>
This avoids the formatting part of those methods (`browse` in the case
of `search`, `display_name` in the case of `name_search`), which is
useless in most cases.

This also enables further optimizations where `_search` and
`_name_search` return subqueries instead of record ids.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This avoids the formatting part of those methods (`browse` in the case
of `search`, `display_name` in the case of `name_search`), which is
useless in most cases.

This also enables further optimizations where `_search` and
`_name_search` return subqueries instead of record ids.</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] core: inline SELECT many2one as subquery for one2many fields</title>
<updated>2020-08-18T13:02:41+00:00</updated>
<author>
<name>Raphael Collet</name>
<email>rco@odoo.com</email>
</author>
<published>2020-06-17T12:18:24+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=89963e0eddbf36d687799acb6ed1e8486cc178e7'/>
<id>89963e0eddbf36d687799acb6ed1e8486cc178e7</id>
<content type='text'>
This avoids the standalone query with a SELECT DISTINCT, which is costly
to execute, and enables potential optimizations in the query execution.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This avoids the standalone query with a SELECT DISTINCT, which is costly
to execute, and enables potential optimizations in the query execution.</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] odoo: one2many fields queries with res_id are narrowed by res_model</title>
<updated>2020-08-03T07:04:36+00:00</updated>
<author>
<name>jerome hanke (jhk)</name>
<email>jhk@odoo.com</email>
</author>
<published>2020-07-12T23:18:16+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=1e0f4188e5ff218324229f9570fe6f6ec545e575'/>
<id>1e0f4188e5ff218324229f9570fe6f6ec545e575</id>
<content type='text'>
Steps to reproduce:
- install helpdesk, hr_expense (the demo data has a clear example of the bug)
- go to helpdesk &gt; tickets &gt; set a custom filter &gt; "activities is set"

Previous behavior:
the results show the ticket with id=2  as if it had an activity set.
Because the search sql query collides with other activities set on other models
(hr.expense.sheet in this example)

Current behavior:
the sql query returns the proper result

opw-2273680

closes odoo/odoo#55297

X-original-commit: 6e90c41413f6a726c08071c71d01c738a6538079
Signed-off-by: Nicolas Lempereur (nle) &lt;nle@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Steps to reproduce:
- install helpdesk, hr_expense (the demo data has a clear example of the bug)
- go to helpdesk &gt; tickets &gt; set a custom filter &gt; "activities is set"

Previous behavior:
the results show the ticket with id=2  as if it had an activity set.
Because the search sql query collides with other activities set on other models
(hr.expense.sheet in this example)

Current behavior:
the sql query returns the proper result

opw-2273680

closes odoo/odoo#55297

X-original-commit: 6e90c41413f6a726c08071c71d01c738a6538079
Signed-off-by: Nicolas Lempereur (nle) &lt;nle@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] core: search on boolean field with operator `in`</title>
<updated>2020-07-14T15:15:11+00:00</updated>
<author>
<name>Raphael Collet</name>
<email>rco@odoo.com</email>
</author>
<published>2020-07-13T12:57:17+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=6c9da4a2066c5f4538ed65894329b3ae262199e7'/>
<id>6c9da4a2066c5f4538ed65894329b3ae262199e7</id>
<content type='text'>
closes odoo/odoo#54457

X-original-commit: 363533b7d50448c06cef2baa68d6f4f634346252
Signed-off-by: Raphael Collet (rco) &lt;rco@openerp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
closes odoo/odoo#54457

X-original-commit: 363533b7d50448c06cef2baa68d6f4f634346252
Signed-off-by: Raphael Collet (rco) &lt;rco@openerp.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
