Merge branch '1310' of github.com:webnotes/erpnext

This commit is contained in:
Anand Doshi 2013-11-05 12:10:08 +05:30
commit 1788c8b4d0

View File

@ -117,6 +117,8 @@ def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
filters.get("company"), "%%%s%%" % txt, start, page_len]))
def item_query(doctype, txt, searchfield, start, page_len, filters):
from webnotes.utils import nowdate
conditions = []
return webnotes.conn.sql("""select tabItem.name,
@ -126,12 +128,19 @@ def item_query(doctype, txt, searchfield, start, page_len, filters):
concat(substr(tabItem.description, 1, 40), "..."), description) as decription
from tabItem
where tabItem.docstatus < 2
and (tabItem.%(key)s LIKE "%(txt)s"
or tabItem.item_name LIKE "%(txt)s")
%(fcond)s %(mcond)s
limit %(start)s,%(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt,
'fcond': get_filters_cond(doctype, filters, conditions),
'mcond': get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})
and (ifnull(tabItem.end_of_life, '') = '' or tabItem.end_of_life > %(today)s)
and (tabItem.`{key}` LIKE %(txt)s
or tabItem.item_name LIKE %(txt)s)
{fcond} {mcond}
limit %(start)s, %(page_len)s """.format(key=searchfield,
fcond=get_filters_cond(doctype, filters, conditions),
mcond=get_match_cond(doctype, searchfield)),
{
"today": nowdate(),
"txt": "%%%s%%" % txt,
"start": start,
"page_len": page_len
})
def bom(doctype, txt, searchfield, start, page_len, filters):
conditions = []