Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Priority not copied from project template (backport #40708) (backport #40710) #40712

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions erpnext/projects/doctype/project/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
9 changes: 7 additions & 2 deletions erpnext/projects/doctype/project/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions erpnext/projects/doctype/task/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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:
Expand Down
Loading