Merge pull request #25943 from rohitwaghchaure/fixed-filters-for-item-query-pre

fix: filter type for item query
This commit is contained in:
Raffael Meyer 2021-06-03 15:58:20 +02:00 committed by GitHub
commit cee0ddea78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
import erpnext import erpnext
import json
from frappe.desk.reportview import get_match_cond, get_filters_cond from frappe.desk.reportview import get_match_cond, get_filters_cond
from frappe.utils import nowdate, getdate from frappe.utils import nowdate, getdate
from collections import defaultdict from collections import defaultdict
@ -198,6 +199,9 @@ def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False): def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False):
conditions = [] conditions = []
if isinstance(filters, str):
filters = json.loads(filters)
#Get searchfields from meta and use in Item Link field query #Get searchfields from meta and use in Item Link field query
meta = frappe.get_meta("Item", cached=True) meta = frappe.get_meta("Item", cached=True)
searchfields = meta.get_search_fields() searchfields = meta.get_search_fields()