* fix: product bundle search input (cherry picked from commit 729fc738af7d78a6f75cb0f794f4c4451d74cd05) * fix: don't select all fields (cherry picked from commit 8c3713b649c7777e35be74b7afe437cec682359e) --------- Co-authored-by: s-aga-r <sagarsharma.s312@gmail.com>
This commit is contained in:
parent
a6f3a103db
commit
922aef665b
@ -76,16 +76,19 @@ class ProductBundle(Document):
|
|||||||
@frappe.validate_and_sanitize_search_inputs
|
@frappe.validate_and_sanitize_search_inputs
|
||||||
def get_new_item_code(doctype, txt, searchfield, start, page_len, filters):
|
def get_new_item_code(doctype, txt, searchfield, start, page_len, filters):
|
||||||
product_bundles = frappe.db.get_list("Product Bundle", {"disabled": 0}, pluck="name")
|
product_bundles = frappe.db.get_list("Product Bundle", {"disabled": 0}, pluck="name")
|
||||||
|
|
||||||
item = frappe.qb.DocType("Item")
|
item = frappe.qb.DocType("Item")
|
||||||
return (
|
query = (
|
||||||
frappe.qb.from_(item)
|
frappe.qb.from_(item)
|
||||||
.select("*")
|
.select(item.item_code, item.item_name)
|
||||||
.where(
|
.where(
|
||||||
(item.is_stock_item == 0)
|
(item.is_stock_item == 0) & (item.is_fixed_asset == 0) & (item[searchfield].like(f"%{txt}%"))
|
||||||
& (item.is_fixed_asset == 0)
|
|
||||||
& (item.name.notin(product_bundles))
|
|
||||||
& (item[searchfield].like(f"%{txt}%"))
|
|
||||||
)
|
)
|
||||||
.limit(page_len)
|
.limit(page_len)
|
||||||
.offset(start)
|
.offset(start)
|
||||||
).run()
|
)
|
||||||
|
|
||||||
|
if product_bundles:
|
||||||
|
query = query.where(item.name.notin(product_bundles))
|
||||||
|
|
||||||
|
return query.run()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user