Merge pull request #7852 from rohitwaghchaure/production_order_issue
[Fix] Production order operations scheduling issue
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index f690878..b395300 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -258,13 +258,11 @@
timesheet = make_timesheet(self.name)
workstation_list = []
- last_workstation_idx = {}
timesheet.set('time_logs', [])
for i, d in enumerate(self.operations):
if d.workstation and d.status != 'Completed':
- last_workstation_idx[d.workstation] = i # set last row index of workstation
- self.set_start_end_time_for_workstation(d, workstation_list, last_workstation_idx.get(d.workstation))
+ self.set_start_end_time_for_workstation(d, workstation_list, i)
args = self.get_operations_data(d)
add_timesheet_detail(timesheet, args)
@@ -318,9 +316,8 @@
"""Set start and end time for given operation. If first operation, set start as
`planned_start_date`, else add time diff to end time of earlier operation."""
- if data.workstation not in workstation_list:
+ if index == 0:
data.planned_start_time = self.planned_start_date
- workstation_list.append(data.workstation)
else:
data.planned_start_time = get_datetime(self.operations[index-1].planned_end_time)\
+ get_mins_between_operations()