mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-17 00:25:01 +00:00
Merge pull request #49176 from frappe/mergify/bp/version-15-hotfix/pr-49163
fix: product bundle child item quantity should be a positive number (backport #49163)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user