How to fetch Data from child table

When creating Project. Task automated fetch on the Project.

@hari.kishor Can you explain what you exactly want.
If you want fetch child table data from another DocType as like (Task and Project DocType) then you can check the below link:

There have how to load task in Project from Task DocType.

class Project(Document):
	def get_feed(self):
		return '{0}: {1}'.format(_(self.status), self.project_name)

	def onload(self):
		"""Load project tasks for quick view"""
		if not self.get('__unsaved') and not self.get("tasks"):

		self.set_onload('activity_summary', frappe.db.sql('''select activity_type,
			sum(hours) as total_hours
			from `tabTimesheet Detail` where project=%s and docstatus < 2 group by activity_type
			order by total_hours desc''',, as_dict=True))


	def __setup__(self):

	def load_tasks(self):
		"""Load `tasks` from the database"""
		self.tasks = []
		for task in self.get_tasks():
			task_map = {
				"title": task.subject,
				"status": task.status,
				"start_date": task.exp_start_date,
				"end_date": task.exp_end_date,
				"description": task.description,
				"task_weight": task.task_weight

			self.map_custom_fields(task, task_map)

			self.append("tasks", task_map)

	def get_tasks(self):
		if is None:
			return {}
			return frappe.get_all("Task", "*", {"project":}, order_by="exp_start_date asc")

And look at the sync_task method how to update Task DocType From Project.

def sync_tasks(self):
		"""sync tasks and remove table"""
		if self.flags.dont_sync_tasks: return
		task_names = []
		for t in self.tasks:
			if t.task_id:
				task = frappe.get_doc("Task", t.task_id)
				task = frappe.new_doc("Task")
				task.project =
				"subject": t.title,
				"status": t.status,
				"exp_start_date": t.start_date,
				"exp_end_date": t.end_date,
				"description": t.description,
				"task_weight": t.task_weight

			self.map_custom_fields(t, task)

			task.flags.ignore_links = True
			task.flags.from_project = True
			task.flags.ignore_feed = True

		# delete
		for t in frappe.get_all("Task", ["name"], {"project":, "name": ("not in", task_names)}):


I want to write custom script to fetch task list when creating Project.

frappe.ui.form.on(“Projects”, “project_task_list”, function(frm, cdt, cdn) {
var itemname = locals[cdt][cdn][‘project_task_list’];
get_project_task_list(frm, cdt, cdn, itemname);

get_project_task_list = function(frm, cdt, cdn, itemname, child) {
frm.doc.task = [];
frappe.after_ajax(function() {{
        "method": "frappe.client.get_list",
        args: {
            doctype: "Project Task",
            fieldname: ["Description", "Item Name"],
            filters: {
                parent: ["like", itemname]
            'order_by': 'idx'
        callback: function(data) {
                       $.each(data.message, function(i, d) {
                    "method": "frappe.client.get_value",
                    args: {
                        doctype: "Project Task",
                        fieldname: ["Description", "Task Name"],
                        filters: {
                            name: ["=",]

                    callback: function(data) {
                        $.each(data, function(i, d) {
                            var row = frappe.model.add_child(cur_frm.doc, "project_task", "item");
                            row.task = d.task;
                            row.task_description = d.task_description;




someone can help me please.