From eeb45c244edc466f165930b2acdc5862afb01e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 5 Apr 2015 23:39:10 +0200 Subject: [PATCH] Fix search_rec_name for negative operator In case of negative operator, each subclause must be composed with 'AND'. issue4559 review11171002 --- commission.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commission.py b/commission.py index c232a6c6d1..6c38a34597 100644 --- a/commission.py +++ b/commission.py @@ -64,7 +64,11 @@ class Agent(ModelSQL, ModelView): @classmethod def search_rec_name(cls, name, clause): - return ['OR', + if clause[1].startswith('!') or clause[1].startswith('not '): + bool_op = 'AND' + else: + bool_op = 'OR' + return [bool_op, ('party',) + tuple(clause[1:]), ('plan',) + tuple(clause[1:]), ]