feat: parent-child relation tasks

This commit is contained in:
pateljannat 2020-12-15 11:50:18 +05:30
parent caf67e608f
commit a6fef7ae6b
2 changed files with 3 additions and 3 deletions

View File

@ -83,6 +83,7 @@ class Project(Document):
def dependency_mapping(self, template_tasks, project_tasks):
for tmp_task in template_tasks:
prj_task = list(filter(lambda x: x.subject == tmp_task.subject, project_tasks))[0]
prj_task = frappe.get_doc("Task", prj_task.name)
self.check_depends_on_value(tmp_task, prj_task, project_tasks)
self.check_for_parent_tasks(tmp_task, prj_task, project_tasks)
@ -95,7 +96,6 @@ class Project(Document):
prj_task.append("depends_on",{
"task": corresponding_prj_task[0].name
})
print(prj_task.name)
prj_task.save()
def check_for_parent_tasks(self, tmp_task, prj_task, project_tasks):

View File

@ -49,10 +49,10 @@ class TestProject(unittest.TestCase):
if not task3:
task3 = create_task(subject="Test Temp Task child 2", parent_task=task1.name, is_template=1, begin=2, duration=3)
template = make_project_template("Test Project Template - tasks with parent-child", [task1])
template = make_project_template("Test Project Template - tasks with parent-child", [task1, task2, task3])
project = get_project("Test Project with Templ - tasks with parent-child", template)
tasks = frappe.get_all('Task', '*', dict(project=project.name), order_by='creation asc')
print(tasks[0].duration)
self.assertEqual(tasks[0].subject, 'Test Temp Task parent')
self.assertEqual(getdate(tasks[0].exp_end_date), calculate_end_date(project, tasks[0]))