Merge pull request #57019 from aerele/backport-56932-version-15-hotfix

fix: validate planned end date is not before planned start date in wo…
This commit is contained in:
Mihir Kandoi
2026-07-10 12:43:01 +05:30
committed by GitHub

View File

@@ -157,6 +157,7 @@ class WorkOrder(Document):
self.check_wip_warehouse_skip()
self.calculate_operating_cost()
self.validate_qty()
self.validate_dates()
self.validate_transfer_against()
self.validate_operations()
self.status = self.get_status()
@@ -175,6 +176,11 @@ class WorkOrder(Document):
self.validate_operations_sequence()
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"))
def validate_operations_sequence(self):
if all([not op.sequence_id for op in self.operations]):
for op in self.operations: