From f870375fa51a56abe536519c095e3b67f4a58060 Mon Sep 17 00:00:00 2001 From: jmartin Date: Mon, 11 Apr 2016 16:44:14 +0200 Subject: [PATCH] Improve search_rec_name method of party --- product.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/product.py b/product.py index b504882..e99bf8c 100644 --- a/product.py +++ b/product.py @@ -28,8 +28,12 @@ class Product: @classmethod def search_rec_name(cls, name, clause): - res = super(Product, cls).search_rec_name(name, clause) - return ['OR', - res, - [('variant_name', ) + tuple(clause[1:])] + domain = super(Product, cls).search_rec_name(name, clause) + if clause[1].startswith('!') or clause[1].startswith('not '): + bool_op = 'AND' + else: + bool_op = 'OR' + return [bool_op, + domain, + ('variant_name', ) + tuple(clause[1:]) ]