fix for queries
This commit is contained in:
parent
4541875c81
commit
2e7ad8980c
@ -442,4 +442,4 @@ def get_expense_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)})
|
||||
|
@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.widgets.reportview import get_match_cond
|
||||
from frappe.model.db_query import DatabaseQuery
|
||||
|
||||
def get_filters_cond(doctype, filters, conditions):
|
||||
if filters:
|
||||
@ -16,9 +17,12 @@ def get_filters_cond(doctype, filters, conditions):
|
||||
else:
|
||||
flt.append([doctype, f[0], '=', f[1]])
|
||||
|
||||
from frappe.widgets.reportview import build_filter_conditions
|
||||
build_filter_conditions(flt, conditions)
|
||||
cond = ' and ' + ' and '.join(conditions)
|
||||
query = DatabaseQuery(doctype)
|
||||
query.filters = flt
|
||||
query.conditions = conditions
|
||||
query.build_filter_conditions()
|
||||
|
||||
cond = ' and ' + ' and '.join(query.conditions)
|
||||
else:
|
||||
cond = ''
|
||||
return cond
|
||||
|
Loading…
x
Reference in New Issue
Block a user