From 9148fc2662f99d7578a9688919567b94ee89e42d Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Tue, 2 Feb 2010 20:34:54 +0530 Subject: [PATCH] [FIX] Search made working for function/related fields with store=True/{...} or fnct_search=method bzr revid: jvo@tinyerp.com-20100202150454-x9kne83yzkjciidw --- bin/osv/expression.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/bin/osv/expression.py b/bin/osv/expression.py index 5a43a17ac9b..5924b62bf20 100644 --- a/bin/osv/expression.py +++ b/bin/osv/expression.py @@ -149,21 +149,21 @@ class expression(object): continue - if field._properties: + if field._properties and ((not field.store) or field._fnct_search): + # this is a function field - if not field.store: - if not field._fnct_search: - # the function field doesn't provide a search function and doesn't store - # values in the database, so we must ignore it : we generate a dummy leaf - self.__exp[i] = self.__DUMMY_LEAF - else: - subexp = field.search(cr, uid, table, left, [self.__exp[i]], context=context) - # we assume that the expression is valid - # we create a dummy leaf for forcing the parsing of the resulting expression - self.__exp[i] = '&' - self.__exp.insert(i + 1, self.__DUMMY_LEAF) - for j, se in enumerate(subexp): - self.__exp.insert(i + 2 + j, se) + if not field._fnct_search: + # the function field doesn't provide a search function and doesn't store + # values in the database, so we must ignore it : we generate a dummy leaf + self.__exp[i] = self.__DUMMY_LEAF + else: + subexp = field.search(cr, uid, table, left, [self.__exp[i]], context=context) + # we assume that the expression is valid + # we create a dummy leaf for forcing the parsing of the resulting expression + self.__exp[i] = '&' + self.__exp.insert(i + 1, self.__DUMMY_LEAF) + for j, se in enumerate(subexp): + self.__exp.insert(i + 2 + j, se) # else, the value of the field is store in the database, so we search on it