fix(work order): Actual start and end dates update (#24360)
Currently, even when the Work Order (without Operations) is completed and Stock Entries are there, the Actual Start Date and Actual End Date is not updated.
For some reason need to db_set, then it updates the Actual Start Date and Actual End Date
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py
index 8e7fac8..ca530bb 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order.py
@@ -456,10 +456,10 @@
if data and len(data):
dates = [d.posting_datetime for d in data]
- self.actual_start_date = min(dates)
+ self.db_set('actual_start_date', min(dates))
if self.status == "Completed":
- self.actual_end_date = max(dates)
+ self.db_set('actual_end_date', max(dates))
self.set_lead_time()