def METHOD_NAME(filters):
	query_filters = {"docstatus": ("<", 2)}
	fields = [
		"name",
		"status",
		"sales_order",
		"production_item",
		"qty",
		"creation",
		"produced_qty",
		"planned_start_date",
		"planned_end_date",
		"actual_start_date",
		"actual_end_date",
		"lead_time",
	]
	for field in ["sales_order", "production_item"]:
		if filters.get(field):
			query_filters[field] = ("in", filters.get(field))
	for field in ["status", "company"]:
		if filters.get(field):
			query_filters[field] = filters.get(field)
	if filters.get("based_on") == "Planned Date":
		query_filters["planned_start_date"] = (">=", filters.get("from_date"))
		query_filters["planned_end_date"] = ("<=", filters.get("to_date"))
	elif filters.get("based_on") == "Actual Date":
		query_filters["actual_start_date"] = (">=", filters.get("from_date"))
		query_filters["actual_end_date"] = ("<=", filters.get("to_date"))
	else:
		query_filters["creation"] = ("between", [filters.get("from_date"), filters.get("to_date")])
	data = frappe.get_all(
		"Work Order", fields=fields, filters=query_filters, order_by="planned_start_date asc", debug=1
	)
	res = []
	for d in data:
		start_date = d.actual_start_date or d.planned_start_date
		d.age = 0
		if d.status != "Completed":
			d.age = date_diff(today(), start_date)
		if filters.get("age") <= d.age:
			res.append(d)
	return res