From 4f4470b9d209dc5b2c04a2c61029d69dd4f976c8 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 27 Mar 2024 15:07:44 +0530 Subject: [PATCH] fix: Priority not copied from project template (cherry picked from commit 33fd7b8a1f125e0387a7a7851a149f91297b9958) --- erpnext/projects/doctype/project/project.py | 1 + erpnext/projects/doctype/project/test_project.py | 9 +++++++-- erpnext/projects/doctype/task/test_task.py | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py index 748c755d3777..8704147cd22f 100644 --- a/erpnext/projects/doctype/project/project.py +++ b/erpnext/projects/doctype/project/project.py @@ -87,6 +87,7 @@ def create_task_from_template(self, task_details): is_group=task_details.is_group, color=task_details.color, template_task=task_details.name, + priority=task_details.priority, ) ).insert() diff --git a/erpnext/projects/doctype/project/test_project.py b/erpnext/projects/doctype/project/test_project.py index e49fecd1f470..b8340ffe1936 100644 --- a/erpnext/projects/doctype/project/test_project.py +++ b/erpnext/projects/doctype/project/test_project.py @@ -23,7 +23,11 @@ def test_project_with_template_having_no_parent_and_depend_tasks(self): task1 = task_exists("Test Template Task with No Parent and Dependency") if not task1: task1 = create_task( - subject="Test Template Task with No Parent and Dependency", is_template=1, begin=5, duration=3 + subject="Test Template Task with No Parent and Dependency", + is_template=1, + begin=5, + duration=3, + priority="High", ) template = make_project_template( @@ -32,11 +36,12 @@ def test_project_with_template_having_no_parent_and_depend_tasks(self): project = get_project(project_name, template) tasks = frappe.get_all( "Task", - ["subject", "exp_end_date", "depends_on_tasks"], + ["subject", "exp_end_date", "depends_on_tasks", "priority"], dict(project=project.name), order_by="creation asc", ) + self.assertEqual(tasks[0].priority, "High") self.assertEqual(tasks[0].subject, "Test Template Task with No Parent and Dependency") self.assertEqual(getdate(tasks[0].exp_end_date), calculate_end_date(project, 5, 3)) self.assertEqual(len(tasks), 1) diff --git a/erpnext/projects/doctype/task/test_task.py b/erpnext/projects/doctype/task/test_task.py index c0333f8f590d..ea7d6edcdf91 100644 --- a/erpnext/projects/doctype/task/test_task.py +++ b/erpnext/projects/doctype/task/test_task.py @@ -122,6 +122,7 @@ def create_task( begin=0, duration=0, save=True, + priority=None, ): if not frappe.db.exists("Task", subject): task = frappe.new_doc("Task") @@ -139,6 +140,7 @@ def create_task( task.duration = duration task.is_group = is_group task.parent_task = parent_task + task.priority = priority if save: task.save() else: