[cleanup] move contact, address to frappe 💥
This commit is contained in:
@@ -3,32 +3,9 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.desk.reportview import get_match_cond
|
||||
from frappe.model.db_query import DatabaseQuery
|
||||
from frappe.desk.reportview import get_match_cond, get_filters_cond
|
||||
from frappe.utils import nowdate
|
||||
|
||||
def get_filters_cond(doctype, filters, conditions):
|
||||
if filters:
|
||||
flt = filters
|
||||
if isinstance(filters, dict):
|
||||
filters = filters.items()
|
||||
flt = []
|
||||
for f in filters:
|
||||
if isinstance(f[1], basestring) and f[1][0] == '!':
|
||||
flt.append([doctype, f[0], '!=', f[1][1:]])
|
||||
else:
|
||||
value = frappe.db.escape(f[1]) if isinstance(f[1], basestring) else f[1]
|
||||
flt.append([doctype, f[0], '=', value])
|
||||
|
||||
query = DatabaseQuery(doctype)
|
||||
query.filters = flt
|
||||
query.conditions = conditions
|
||||
query.build_filter_conditions(flt, conditions)
|
||||
|
||||
cond = ' and ' + ' and '.join(query.conditions)
|
||||
else:
|
||||
cond = ''
|
||||
return cond
|
||||
|
||||
# searches for active employees
|
||||
def employee_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
@@ -88,7 +65,7 @@ def customer_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
fields = ["name", "customer_group", "territory"]
|
||||
else:
|
||||
fields = ["name", "customer_name", "customer_group", "territory"]
|
||||
|
||||
|
||||
meta = frappe.get_meta("Customer")
|
||||
fields = fields + [f for f in meta.get_search_fields() if not f in fields]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user