fix: validate planned end date is not before planned start date in work order

This commit is contained in:
pandiyan
2026-07-07 16:11:55 +05:30
parent 607f0e943f
commit 2ec780cb35

View File

@@ -11,6 +11,7 @@ from frappe.query_builder.functions import Coalesce, IfNull, Sum
from frappe.utils import (
cint,
flt,
get_datetime,
get_link_to_form,
now,
nowdate,
@@ -317,6 +318,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"))