From 745baad0d1ad861e3be119c17db2dd1346ae29ea Mon Sep 17 00:00:00 2001 From: pandiyan Date: Tue, 7 Jul 2026 16:11:55 +0530 Subject: [PATCH] fix: validate planned end date is not before planned start date in work order (cherry picked from commit 2ec780cb353b74de25802b9062dca8c8c6956edd) --- erpnext/manufacturing/doctype/work_order/work_order.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py index 3f470ccd216..2454341dc39 100644 --- a/erpnext/manufacturing/doctype/work_order/work_order.py +++ b/erpnext/manufacturing/doctype/work_order/work_order.py @@ -295,6 +295,10 @@ class WorkOrder(Document): self.validate_subcontracting_inward_order() def validate_dates(self): + if self.planned_start_date and self.planned_end_date: + if get_datetime(self.planned_end_date) < get_datetime(self.planned_start_date): + frappe.throw(_("Planned End Date cannot be before Planned Start Date")) + if self.actual_start_date and self.actual_end_date: if self.actual_end_date < self.actual_start_date: frappe.throw(_("Actual End Date cannot be before Actual Start Date"))