Skip to content

Commit

Permalink
fix: validation for existing bundles
Browse files Browse the repository at this point in the history
(cherry picked from commit 67f43d3)
  • Loading branch information
GursheenK authored and mergify[bot] committed Nov 24, 2023
1 parent 5c12872 commit c0de9c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions erpnext/selling/doctype/product_bundle/product_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def validate_main_item(self):

def validate_child_items(self):
for item in self.items:
if frappe.db.exists("Product Bundle", item.item_code):
if frappe.db.exists("Product Bundle", {"name": item.item_code, "disabled": 0}):
frappe.throw(
_(
"Row #{0}: Child Item should not be a Product Bundle. Please remove Item {1} and Save"
Expand All @@ -75,7 +75,7 @@ def validate_child_items(self):
@frappe.whitelist()
@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", pluck="name")
product_bundles = frappe.db.get_list("Product Bundle", {"disabled": 0}, pluck="name")
item = frappe.qb.DocType("Item")
return (
frappe.qb.from_(item)
Expand Down

0 comments on commit c0de9c0

Please sign in to comment.