summaryrefslogtreecommitdiff
path: root/odoo/models.py
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2020-05-05 12:56:07 +0000
committerRaphael Collet <rco@odoo.com>2020-05-20 07:56:44 +0000
commit84a595301edeb558f93ce5509efdcd8e30fd2a64 (patch)
tree92b20abade241617d6aa51737958c9489426fd84 /odoo/models.py
parent0fa101a8bf13671162bda91deb98bd0c7ec76f3f (diff)
[REF] expression: use and return a Query object
The management of the join contexts now relies on the `Query` object, that has all the necessary logic to do so. The refactoring also removes the class `ExtendedLeaf`, which is no longer necessary: the join contexts are all managed by a single `Query` object, and the parsing stack now only contains triples like (leaf, model, table_alias). Also inline directly the SQL translation made in `_to_sql`, which overall simplifies the management of SQL parameters in the domain compilation. The algorithm is illustrated in the code itself.
Diffstat (limited to 'odoo/models.py')
-rw-r--r--odoo/models.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/odoo/models.py b/odoo/models.py
index bbdb91b0369..e9a5f9ff636 100644
--- a/odoo/models.py
+++ b/odoo/models.py
@@ -4112,14 +4112,9 @@ Record ids: %(records)s
domain = [(self._active_name, '=', 1)] + domain
if domain:
- e = expression.expression(domain, self)
- tables = e.get_tables()
- where_clause, where_params = e.to_sql()
- where_clause = [where_clause] if where_clause else []
+ return expression.expression(domain, self).query
else:
- where_clause, where_params, tables = [], [], ['"%s"' % self._table]
-
- return Query(tables, where_clause, where_params)
+ return Query(['"%s"' % self._table])
def _check_qorder(self, word):
if not regex_order.match(word):