removed searchfield condition from get_match_cond frappe/erpnext#1457

This commit is contained in:
Rushabh Mehta 2014-03-06 11:18:37 +05:30
parent 0fabc6a841
commit 4541875c81
7 changed files with 17 additions and 17 deletions

View File

@ -153,7 +153,7 @@ def gl_entry_details(doctype, txt, searchfield, start, page_len, filters):
"dt":filters["dt"],
"acc":filters["acc"],
"account_type": filters['account_type'],
'mcond':get_match_cond(doctype, searchfield),
'mcond':get_match_cond(doctype),
'txt': "%%%s%%" % txt,
"start": start,
"page_len": page_len

View File

@ -793,7 +793,7 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters):
and tabAccount.company = '%(company)s'
and tabAccount.%(key)s LIKE '%(txt)s'
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)})
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype)})
@frappe.whitelist()

View File

@ -36,7 +36,7 @@ def employee_query(doctype, txt, searchfield, start, page_len, filters):
case when employee_name like "%(txt)s" then 0 else 1 end,
name
limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt,
'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})
'mcond':get_match_cond(doctype), 'start': start, 'page_len': page_len})
# searches for leads which are not converted
def lead_query(doctype, txt, searchfield, start, page_len, filters):
@ -53,7 +53,7 @@ def lead_query(doctype, txt, searchfield, start, page_len, filters):
case when company_name like "%(txt)s" then 0 else 1 end,
lead_name asc
limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt,
'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})
'mcond':get_match_cond(doctype), 'start': start, 'page_len': page_len})
# searches for customer
def customer_query(doctype, txt, searchfield, start, page_len, filters):
@ -76,7 +76,7 @@ def customer_query(doctype, txt, searchfield, start, page_len, filters):
case when customer_name like "%(txt)s" then 0 else 1 end,
name, customer_name
limit %(start)s, %(page_len)s""" % {'field': fields,'key': searchfield,
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype),
'start': start, 'page_len': page_len})
# searches for supplier
@ -98,7 +98,7 @@ def supplier_query(doctype, txt, searchfield, start, page_len, filters):
case when supplier_name like "%(txt)s" then 0 else 1 end,
name, supplier_name
limit %(start)s, %(page_len)s """ % {'field': fields,'key': searchfield,
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), 'start': start,
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype), 'start': start,
'page_len': page_len})
def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
@ -134,7 +134,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters):
{fcond} {mcond}
limit %(start)s, %(page_len)s """.format(key=searchfield,
fcond=get_filters_cond(doctype, filters, conditions),
mcond=get_match_cond(doctype, searchfield)),
mcond=get_match_cond(doctype)),
{
"today": nowdate(),
"txt": "%%%s%%" % txt,
@ -153,7 +153,7 @@ def bom(doctype, txt, searchfield, start, page_len, filters):
%(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})
'mcond':get_match_cond(doctype), 'start': start, 'page_len': page_len})
def get_project_name(doctype, txt, searchfield, start, page_len, filters):
cond = ''
@ -165,7 +165,7 @@ def get_project_name(doctype, txt, searchfield, start, page_len, filters):
and %(cond)s `tabProject`.name like "%(txt)s" %(mcond)s
order by `tabProject`.name asc
limit %(start)s, %(page_len)s """ % {'cond': cond,'txt': "%%%s%%" % txt,
'mcond':get_match_cond(doctype, searchfield),'start': start, 'page_len': page_len})
'mcond':get_match_cond(doctype),'start': start, 'page_len': page_len})
def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select `tabDelivery Note`.name, `tabDelivery Note`.customer_name
@ -202,7 +202,7 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
order by batch_no desc
limit %(start)s, %(page_len)s """ % {'item_code': filters['item_code'],
'warehouse': filters['warehouse'], 'posting_date': filters['posting_date'],
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype),
'start': start, 'page_len': page_len})
else:
return frappe.db.sql("""select name from tabBatch
@ -214,5 +214,5 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
order by name desc
limit %(start)s, %(page_len)s""" % {'item_code': filters['item_code'],
'posting_date': filters['posting_date'], 'txt': "%%%s%%" % txt,
'mcond':get_match_cond(doctype, searchfield),'start': start,
'mcond':get_match_cond(doctype),'start': start,
'page_len': page_len})

View File

@ -85,5 +85,5 @@ def get_project(doctype, txt, searchfield, start, page_len, filters):
%(mcond)s
order by name
limit %(start)s, %(page_len)s """ % {'key': searchfield,
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype),
'start': start, 'page_len': page_len})

View File

@ -39,5 +39,5 @@ def get_new_item_code(doctype, txt, searchfield, start, page_len, filters):
where is_stock_item="No" and is_sales_item="Yes"
and name not in (select name from `tabSales BOM`) and %s like %s
%s limit %s, %s""" % (searchfield, "%s",
get_match_cond(doctype, searchfield),"%s", "%s"),
get_match_cond(doctype),"%s", "%s"),
("%%%s%%" % txt, start, page_len))

View File

@ -171,5 +171,5 @@ def item_details(doctype, txt, searchfield, start, page_len, filters):
and ifnull(qty, 0) > ifnull(packed_qty, 0))
and %s like "%s" %s
limit %s, %s """ % ("%s", searchfield, "%s",
get_match_cond(doctype, searchfield), "%s", "%s"),
get_match_cond(doctype), "%s", "%s"),
(filters["delivery_note"], "%%%s%%" % txt, start, page_len))

View File

@ -631,7 +631,7 @@ def query_sales_return_doc(doctype, txt, searchfield, start, page_len, filters):
or `customer` like %%(txt)s) %s %s
order by name, customer, customer_name
limit %s""" % (doctype, searchfield, conditions,
get_match_cond(doctype, searchfield), "%(start)s, %(page_len)s"),
get_match_cond(doctype), "%(start)s, %(page_len)s"),
{"txt": "%%%s%%" % txt, "start": start, "page_len": page_len},
as_list=True)
@ -641,7 +641,7 @@ def query_purchase_return_doc(doctype, txt, searchfield, start, page_len, filter
and (`%s` like %%(txt)s
or `supplier` like %%(txt)s) %s
order by name, supplier, supplier_name
limit %s""" % (doctype, searchfield, get_match_cond(doctype, searchfield),
limit %s""" % (doctype, searchfield, get_match_cond(doctype),
"%(start)s, %(page_len)s"), {"txt": "%%%s%%" % txt, "start":
start, "page_len": page_len}, as_list=True)
@ -679,7 +679,7 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
's_warehouse': filters['s_warehouse'],
'posting_date': filters['posting_date'],
'txt': "%%%s%%" % txt,
'mcond':get_match_cond(doctype, searchfield),
'mcond':get_match_cond(doctype),
"start": start,
"page_len": page_len
}