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.company = '%(company)s'
|
||||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
%(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
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.widgets.reportview import get_match_cond
|
from frappe.widgets.reportview import get_match_cond
|
||||||
|
from frappe.model.db_query import DatabaseQuery
|
||||||
|
|
||||||
def get_filters_cond(doctype, filters, conditions):
|
def get_filters_cond(doctype, filters, conditions):
|
||||||
if filters:
|
if filters:
|
||||||
@ -16,9 +17,12 @@ def get_filters_cond(doctype, filters, conditions):
|
|||||||
else:
|
else:
|
||||||
flt.append([doctype, f[0], '=', f[1]])
|
flt.append([doctype, f[0], '=', f[1]])
|
||||||
|
|
||||||
from frappe.widgets.reportview import build_filter_conditions
|
query = DatabaseQuery(doctype)
|
||||||
build_filter_conditions(flt, conditions)
|
query.filters = flt
|
||||||
cond = ' and ' + ' and '.join(conditions)
|
query.conditions = conditions
|
||||||
|
query.build_filter_conditions()
|
||||||
|
|
||||||
|
cond = ' and ' + ' and '.join(query.conditions)
|
||||||
else:
|
else:
|
||||||
cond = ''
|
cond = ''
|
||||||
return cond
|
return cond
|
||||||
|
Loading…
x
Reference in New Issue
Block a user