From 93a7385ccc757bb0400b08e647c269b9cbc7d4e5 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 30 May 2013 11:53:13 +0530 Subject: [PATCH] [search] convert filters from dict to list before using reportview's query system --- webnotes/widgets/search.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/webnotes/widgets/search.py b/webnotes/widgets/search.py index f5ac314c8f..320c5dbe9f 100644 --- a/webnotes/widgets/search.py +++ b/webnotes/widgets/search.py @@ -41,10 +41,6 @@ def search_widget(doctype, txt, query=None, searchfield="name", start=0, if isinstance(filters, basestring): import json filters = json.loads(filters) - if isinstance(filters, dict): - filters = map(lambda f: [doctype, f[0], "=", f[1]], filters.items()) - if filters==None: - filters = [] meta = webnotes.get_doctype(doctype) @@ -62,6 +58,11 @@ def search_widget(doctype, txt, query=None, searchfield="name", start=0, webnotes.response["values"] = webnotes.conn.sql(scrub_custom_query(query, searchfield, txt)) else: + if isinstance(filters, dict): + filters = map(lambda f: [doctype, f[0], "=", f[1]], filters.items()) + if filters==None: + filters = [] + # build from doctype if txt: filters.append([doctype, searchfield, "like", txt + "%"])