Skip to content

Commit

Permalink
[FIX] expression: ensure tuple to compare leaf with TRUE/FALSE leaf
Browse files Browse the repository at this point in the history
When setting a custom filter with as domain
[(0, '=', 1)]

the domain was rejected, because (0, '=', 1) wasn't
considered as a valid leaf, while it is.

This is because the Javascript converts this domain
using list instead of tuple
[(0, '=', 1)] -> [[0, '=', 1]]

And therefore, comparing the "list" leaf
to the TRUE/FALSE leaf tuple failed.

Ensuring "element" as a tuple solves the issue.

opw-640306
  • Loading branch information
beledouxdenis committed May 20, 2015
1 parent cc61d46 commit 54a9017
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion openerp/osv/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def is_leaf(element, internal=False):
and len(element) == 3 \
and element[1] in INTERNAL_OPS \
and ((isinstance(element[0], basestring) and element[0])
or element in (TRUE_LEAF, FALSE_LEAF))
or tuple(element) in (TRUE_LEAF, FALSE_LEAF))


# --------------------------------------------------
Expand Down

0 comments on commit 54a9017

Please sign in to comment.