Merge pull request #40710 from frappe/mergify/bp/version-14-hotfix/pr-40708

fix: Priority not copied from project template (backport #40708)
This commit is contained in:
rohitwaghchaure
2024-03-27 16:17:57 +05:30
committed by GitHub
3 changed files with 10 additions and 2 deletions

View File

@@ -87,6 +87,7 @@ class Project(Document):
is_group=task_details.is_group, is_group=task_details.is_group,
color=task_details.color, color=task_details.color,
template_task=task_details.name, template_task=task_details.name,
priority=task_details.priority,
) )
).insert() ).insert()

View File

@@ -23,7 +23,11 @@ class TestProject(FrappeTestCase):
task1 = task_exists("Test Template Task with No Parent and Dependency") task1 = task_exists("Test Template Task with No Parent and Dependency")
if not task1: if not task1:
task1 = create_task( 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( template = make_project_template(
@@ -32,11 +36,12 @@ class TestProject(FrappeTestCase):
project = get_project(project_name, template) project = get_project(project_name, template)
tasks = frappe.get_all( tasks = frappe.get_all(
"Task", "Task",
["subject", "exp_end_date", "depends_on_tasks"], ["subject", "exp_end_date", "depends_on_tasks", "priority"],
dict(project=project.name), dict(project=project.name),
order_by="creation asc", 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(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(getdate(tasks[0].exp_end_date), calculate_end_date(project, 5, 3))
self.assertEqual(len(tasks), 1) self.assertEqual(len(tasks), 1)

View File

@@ -122,6 +122,7 @@ def create_task(
begin=0, begin=0,
duration=0, duration=0,
save=True, save=True,
priority=None,
): ):
if not frappe.db.exists("Task", subject): if not frappe.db.exists("Task", subject):
task = frappe.new_doc("Task") task = frappe.new_doc("Task")
@@ -139,6 +140,7 @@ def create_task(
task.duration = duration task.duration = duration
task.is_group = is_group task.is_group = is_group
task.parent_task = parent_task task.parent_task = parent_task
task.priority = priority
if save: if save:
task.save() task.save()
else: else: