feat: Use controller for serial no. API
diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py
index a421a20..c6d1ed2 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.py
+++ b/erpnext/stock/doctype/serial_no/serial_no.py
@@ -462,15 +462,5 @@
 
 @frappe.whitelist()
 def auto_fetch_serial_number(qty, item_code, warehouse):
-	serial_numbers = frappe.db.sql_list("""select name from `tabSerial No`
-		where
-			item_code = %(item_code)s
-			and warehouse = %(warehouse)s
-			and delivery_document_no is null
-			and sales_invoice is null
-		limit {0}""".format(cint(qty)), {
-		'item_code': item_code,
-		'warehouse': warehouse
-	})
-
+	serial_numbers = frappe.get_list("Serial No", filters={"item_code": item_code, "warehouse": warehouse, "delivery_document_no": "", "sales_invoice": ""}, limit=qty, order_by="creation")
 	return serial_numbers
\ No newline at end of file