From f831d45cc3972162a8f118b9d2f88f0be8871454 Mon Sep 17 00:00:00 2001 From: diptanilsaha Date: Thu, 14 Aug 2025 11:49:09 +0530 Subject: [PATCH] fix: product bundle child item quantity should be a positive number (cherry picked from commit 711076d02d7630517b714e8afe1e638d6710453d) --- .../selling/doctype/product_bundle/product_bundle.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/erpnext/selling/doctype/product_bundle/product_bundle.py b/erpnext/selling/doctype/product_bundle/product_bundle.py index 609f45a608f..5c981244d10 100644 --- a/erpnext/selling/doctype/product_bundle/product_bundle.py +++ b/erpnext/selling/doctype/product_bundle/product_bundle.py @@ -32,6 +32,7 @@ class ProductBundle(Document): def validate(self): self.validate_main_item() self.validate_child_items() + self.validate_child_items_qty_non_zero() from erpnext.utilities.transaction_base import validate_uom_is_integer validate_uom_is_integer(self, "uom", "qty") @@ -88,6 +89,15 @@ class ProductBundle(Document): ).format(item.idx, frappe.bold(item.item_code)) ) + def validate_child_items_qty_non_zero(self): + for item in self.items: + if item.qty <= 0: + frappe.throw( + _( + "Row #{0}: Quantity cannot be a non-positive number. Please increase the quantity or remove the Item {1}" + ).format(item.idx, frappe.bold(item.item_code)) + ) + @frappe.whitelist() @frappe.validate_and_sanitize_search_inputs