From 7a9fd6937d3abb291715fc37e151231504c2427a Mon Sep 17 00:00:00 2001 From: Sudharsanan11 Date: Sun, 24 May 2026 21:43:07 +0530 Subject: [PATCH] fix(manufacturing): validate batch size --- erpnext/manufacturing/doctype/work_order/work_order.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py index e2c221487c0..49765f3a79c 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.py +++ b/erpnext/manufacturing/doctype/work_order/work_order.py @@ -202,7 +202,7 @@ class WorkOrder(Document): self.calculate_operating_cost() self.validate_qty() self.validate_transfer_against() - self.validate_operation_time() + self.validate_operations() self.status = self.get_status() self.validate_workstation_type() self.reset_use_multi_level_bom() @@ -1499,8 +1499,11 @@ class WorkOrder(Document): title=_("Missing value"), ) - def validate_operation_time(self): + def validate_operations(self): for d in self.operations: + if not d.batch_size or d.batch_size <= 0: + d.batch_size = 1 + if d.time_in_mins <= 0: frappe.throw(_("Operation Time must be greater than 0 for Operation {0}").format(d.operation))