[FIX] Remove deprecated gen_object.next() function (#15418)

BOM tree view was getting impacted due to use of a deprecated function.
This fix replaces deprecated object.next() function with next(gen_object).
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 7ad5a7f..38e6156 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -661,8 +661,8 @@
 			# extend bom_item dict with respective item dict
 			bom_item.update(
 				# returns an item dict from items list which matches with item_code
-				(item for item in items if item.get('name')
-					== bom_item.get('item_code')).next()
+				next(item for item in items if item.get('name')
+					== bom_item.get('item_code'))
 			)
 			bom_item.expandable = 0 if bom_item.value in ('', None)  else 1