fix: Add project filter in parent task field (#22655)

* fix: Add project filter in parent task field
diff --git a/erpnext/projects/doctype/task/task.js b/erpnext/projects/doctype/task/task.js
index a044e1d..8c6a9cf 100644
--- a/erpnext/projects/doctype/task/task.js
+++ b/erpnext/projects/doctype/task/task.js
@@ -29,10 +29,16 @@
 				filters: filters
 			};
 		})
-	},
 
-	refresh: function (frm) {
-		frm.set_query("parent_task", { "is_group": 1 });
+		frm.set_query("parent_task", function () {
+			let filters = {
+				"is_group": 1
+			};
+			if (frm.doc.project) filters["project"] = frm.doc.project;
+			return {
+				filters: filters
+			}
+		});
 	},
 
 	is_group: function (frm) {