Merge pull request #38377 from s-aga-r/FIX-PB-SEARCH-INPUT

fix: Product Bundle Parent Item input
This commit is contained in:
s-aga-r 2023-11-28 14:34:26 +05:30 committed by GitHub
commit 9872e371a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,16 +76,19 @@ class ProductBundle(Document):
@frappe.validate_and_sanitize_search_inputs
def get_new_item_code(doctype, txt, searchfield, start, page_len, filters):
product_bundles = frappe.db.get_list("Product Bundle", {"disabled": 0}, pluck="name")
item = frappe.qb.DocType("Item")
return (
query = (
frappe.qb.from_(item)
.select("*")
.select(item.item_code, item.item_name)
.where(
(item.is_stock_item == 0)
& (item.is_fixed_asset == 0)
& (item.name.notin(product_bundles))
& (item[searchfield].like(f"%{txt}%"))
(item.is_stock_item == 0) & (item.is_fixed_asset == 0) & (item[searchfield].like(f"%{txt}%"))
)
.limit(page_len)
.offset(start)
).run()
)
if product_bundles:
query = query.where(item.name.notin(product_bundles))
return query.run()