Skip to content

Commit

Permalink
fix: Server Error while creating Product Bundle (backport #38377) (#3…
Browse files Browse the repository at this point in the history
…8380)

* fix: product bundle search input

(cherry picked from commit 729fc73)

* fix: don't select all fields

(cherry picked from commit 8c3713b)

---------

Co-authored-by: s-aga-r <sagarsharma.s312@gmail.com>
  • Loading branch information
mergify[bot] and s-aga-r committed Nov 28, 2023
1 parent a6f3a10 commit 922aef6
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions erpnext/selling/doctype/product_bundle/product_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,19 @@ def validate_child_items(self):
@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()

0 comments on commit 922aef6

Please sign in to comment.