Merge pull request #49163 from diptanilsaha/fix-product-bundle-qty

fix: product bundle child item quantity should be a positive number
This commit is contained in:
Diptanil Saha
2025-08-14 18:46:23 +05:30
committed by GitHub

View File

@@ -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