Merge pull request #22109 from rohitwaghchaure/routing-operations-not-in-a-sequence

fix: routing operations not added sequentially in the BOM
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 3253a49..2543eec 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -112,13 +112,14 @@
 		if self.routing:
 			self.set("operations", [])
 			for d in frappe.get_all("BOM Operation", fields = ["*"],
-				filters = {'parenttype': 'Routing', 'parent': self.routing}):
+				filters = {'parenttype': 'Routing', 'parent': self.routing}, order_by="idx"):
 				child = self.append('operations', {
 					"operation": d.operation,
 					"workstation": d.workstation,
 					"description": d.description,
 					"time_in_mins": d.time_in_mins,
-					"batch_size": d.batch_size
+					"batch_size": d.batch_size,
+					"idx": d.idx
 				})
 				child.hour_rate = flt(d.hour_rate / self.conversion_rate, 2)