[FIX] expression: child_of domain with parent_store & non-existing parent

In the `product.template` model,
when searching products within a category that doesn't exist,
all products were returned, while none should be returned.

For instance,
In Sales > Products,
In the search input, search with internal category:
"A category that doesn't exist",
all products were returned.

opw-649548
This commit is contained in:
Denis Ledoux
2015-11-10 16:35:55 +01:00
parent a8ae94485d
commit 56c08e486f
+2
View File
@@ -729,6 +729,8 @@ class expression(object):
""" Return a domain implementing the child_of operator for [(left,child_of,ids)],
either as a range using the parent_left/right tree lookup fields
(when available), or as an expanded [(left,in,child_ids)] """
if not ids:
return FALSE_DOMAIN
if left_model._parent_store and (not left_model.pool._init):
# TODO: Improve where joins are implemented for many with '.', replace by:
# doms += ['&',(prefix+'.parent_left','<',o.parent_right),(prefix+'.parent_left','>=',o.parent_left)]