From 63edd5ddc6b6894102fd6d40ea735113022f995c Mon Sep 17 00:00:00 2001 From: Vinay Mishra <39999379+vinaymishraofficial@users.noreply.github.com> Date: Tue, 28 Apr 2026 10:42:49 +0530 Subject: [PATCH] fix: negative quantity check in validate_item_qty (#54559) Fix negative quantity check in validate_item_qty When saving a Blanket Order with a blank qty field in the items table, the following error is raised: TypeError: '<' not supported between instances of 'NoneType' and 'int' Root cause: The validate_item_qty method compares d.qty < 0 directly. When the qty field is left empty, its value is None, and Python cannot compare None with an integer. Fix Wrap d.qty with flt(), which safely converts None (and any non-numeric value) to 0.0 before the comparison. # Before if d.qty < 0: # After if flt(d.qty) < 0: --- erpnext/manufacturing/doctype/blanket_order/blanket_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order.py b/erpnext/manufacturing/doctype/blanket_order/blanket_order.py index 946e7cb2d0c..003df602aa1 100644 --- a/erpnext/manufacturing/doctype/blanket_order/blanket_order.py +++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order.py @@ -120,7 +120,7 @@ class BlanketOrder(Document): def validate_item_qty(self): for d in self.items: - if d.qty < 0: + if flt(d.qty) < 0: frappe.throw(_("Row {0}: Quantity cannot be negative.").format(d.idx))