test: added test for serial no. filters
diff --git a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py
index 37ea3fd..7f1ea9b 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py
+++ b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py
@@ -8,7 +8,10 @@
 
 from erpnext.maintenance.doctype.maintenance_schedule.maintenance_schedule import (
 	make_maintenance_visit,
+	update_serial_nos,
 )
+from erpnext.stock.doctype.item.test_item import create_item
+from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
 
 # test_records = frappe.get_test_records('Maintenance Schedule')
 
@@ -75,6 +78,41 @@
 		#checks if visit status is back updated in schedule
 		self.assertTrue(ms.schedules[1].completion_status, "Partially Completed")
 
+	def test_serial_no_filters(self):
+		# Without serial no. set in schedule -> returns None
+		item_code = "_Test Serial Item"
+		make_serial_item_with_serial(item_code)
+		ms = make_maintenance_schedule(item_code=item_code)
+		ms.submit()
+
+		s_item = ms.schedules[0]
+		mv = make_maintenance_visit(source_name=ms.name, item_name=item_code, s_id=s_item.name)
+		mvi = mv.purposes[0]
+		serial_nos = update_serial_nos(mvi.item_name, ms.name)
+		self.assertEqual(serial_nos, None)
+
+		# With serial no. set in schedule -> returns serial nos.
+		make_serial_item_with_serial(item_code)
+		ms = make_maintenance_schedule(item_code=item_code, serial_no="TEST001, TEST002")
+		ms.submit()
+
+		s_item = ms.schedules[0]
+		mv = make_maintenance_visit(source_name=ms.name, item_name=item_code, s_id=s_item.name)
+		mvi = mv.purposes[0]
+		serial_nos = update_serial_nos(mvi.item_name, ms.name)
+		self.assertEqual(serial_nos, ["TEST001", "TEST002"])
+
+		frappe.db.rollback()
+
+def make_serial_item_with_serial(item_code):
+	serial_item_doc = create_item(item_code, is_stock_item=1)
+	if not serial_item_doc.has_serial_no or not serial_item_doc.serial_no_series:
+		serial_item_doc.has_serial_no = 1
+		serial_item_doc.serial_no_series = "TEST.###"
+		serial_item_doc.save(ignore_permissions=True)
+	if frappe.db.exists('Serial No', {"status": "Active", "item_code": item_code}):
+		make_serialized_item(item_code=item_code)
+
 def get_events(ms):
 	return frappe.get_all("Event Participants", filters={
 			"reference_doctype": ms.doctype,
@@ -82,17 +120,18 @@
 			"parenttype": "Event"
 		})
 
-def make_maintenance_schedule():
+def make_maintenance_schedule(**args):
 	ms = frappe.new_doc("Maintenance Schedule")
 	ms.company = "_Test Company"
 	ms.customer = "_Test Customer"
 	ms.transaction_date = today()
 
 	ms.append("items", {
-		"item_code": "_Test Item",
+		"item_code": args.get("item_code") or "_Test Item",
 		"start_date": today(),
 		"periodicity": "Weekly",
 		"no_of_visits": 4,
+		"serial_no": args.get("serial_no"),
 		"sales_person": "Sales Team",
 	})
 	ms.insert(ignore_permissions=True)