[hub] items searchable via core filters

This commit is contained in:
Prateeksha Singh
2018-01-26 15:39:13 +05:30
parent b8e9c9be08
commit 3eaccffbd9
3 changed files with 45 additions and 32 deletions

View File

@@ -15,25 +15,15 @@ def enable_hub():
return hub_settings
@frappe.whitelist()
def get_items(start=0, limit=20, fields=["*"], category=None, order_by=None, company=None, text=None):
def get_items(doctype, start=0, limit=20, fields=["*"], filters="{}", order_by=None):
connection = get_client_connection()
filters = json.loads(filters)
filters = {}
if category:
filters.update({ 'hub_category': category })
if text:
filters.update({'item_name': ('like', '%' + text + '%')})
if company:
filters.update({'company_name': company})
response = connection.get_list('Hub Item',
response = connection.get_list(doctype,
limit_start=start, limit_page_length=limit,
filters=filters, fields=fields)
return response
#
@frappe.whitelist()
def get_hub_item_meta():
connection = get_client_connection()