fix: filter the item tax template using the input text
(cherry picked from commit 4dd37ba033)
# Conflicts:
# erpnext/controllers/queries.py
This commit is contained in:
@@ -807,7 +807,27 @@ def get_tax_template(doctype, txt, searchfield, start, page_len, filters):
|
||||
item_group = item_group_doc.parent_item_group
|
||||
|
||||
if not taxes:
|
||||
return frappe.get_all("Item Tax Template", filters={"disabled": 0, "company": company}, as_list=True)
|
||||
or_filters = []
|
||||
if txt:
|
||||
search_fields = ["name"]
|
||||
|
||||
tax_template_doc = frappe.get_meta("Item Tax Template")
|
||||
|
||||
if title_field := tax_template_doc.title_field:
|
||||
search_fields.append(title_field)
|
||||
if tax_template_doc.search_fields:
|
||||
search_fields.extend(tax_template_doc.get_search_fields())
|
||||
|
||||
for f in search_fields:
|
||||
or_filters.append([doctype, f.strip(), "like", f"%{txt}%"])
|
||||
|
||||
return frappe.get_list(
|
||||
"Item Tax Template",
|
||||
filters={"disabled": 0, "company": company},
|
||||
or_filters=or_filters,
|
||||
as_list=True,
|
||||
)
|
||||
|
||||
else:
|
||||
valid_from = filters.get("valid_from")
|
||||
valid_from = valid_from[1] if isinstance(valid_from, list) else valid_from
|
||||
@@ -819,8 +839,14 @@ def get_tax_template(doctype, txt, searchfield, start, page_len, filters):
|
||||
"company": company,
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
taxes = _get_item_tax_template(args, taxes, for_validate=True)
|
||||
return [(d,) for d in set(taxes)]
|
||||
=======
|
||||
taxes = _get_item_tax_template(ctx, taxes, for_validate=True)
|
||||
txt = txt.lower()
|
||||
return [(d,) for d in set(taxes) if not txt or txt in d.lower()]
|
||||
>>>>>>> 4dd37ba033 (fix: filter the item tax template using the input text)
|
||||
|
||||
|
||||
def get_fields(doctype, fields=None):
|
||||
|
||||
Reference in New Issue
Block a user