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(UX): Add a subject field. #22638

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 15 additions & 7 deletions frappe/desk/doctype/todo/test_todo.py
Expand Up @@ -12,7 +12,7 @@
class TestToDo(FrappeTestCase):
def test_delete(self):
todo = frappe.get_doc(
dict(doctype="ToDo", description="test todo", assigned_by="Administrator")
dict(doctype="ToDo", subject="First todo", description="test todo", assigned_by="Administrator")
).insert()

frappe.db.delete("Deleted Document")
Expand All @@ -25,7 +25,9 @@ def test_delete(self):

def test_fetch(self):
todo = frappe.get_doc(
dict(doctype="ToDo", description="test todo", assigned_by="Administrator")
dict(
doctype="ToDo", subject="Another todo", description="test todo", assigned_by="Administrator"
)
).insert()
self.assertEqual(
todo.assigned_by_full_name, frappe.db.get_value("User", todo.assigned_by, "full_name")
Expand Down Expand Up @@ -58,10 +60,10 @@ def test_fetch_setup(self):
)

def test_todo_list_access(self):
create_new_todo("Test1", "testperm@example.com")
create_new_todo("Test1", "This is the description.", "testperm@example.com")

frappe.set_user("test4@example.com")
create_new_todo("Test2", "test4@example.com")
create_new_todo("Test2", "This is a test todo.", "test4@example.com")
test_user_data = DatabaseQuery("ToDo").execute()

frappe.set_user("testperm@example.com")
Expand Down Expand Up @@ -128,7 +130,8 @@ def test_fetch_if_empty(self):
todo = frappe.get_doc(
dict(
doctype="ToDo",
description="test todo",
subject="Launch new product",
description="This is a test todo.",
assigned_by="Administrator",
assigned_by_full_name="Admin",
)
Expand All @@ -148,6 +151,11 @@ def test_fetch_if_empty(self):
)


def create_new_todo(description, assigned_by):
todo = {"doctype": "ToDo", "description": description, "assigned_by": assigned_by}
def create_new_todo(subject, description, assigned_by):
todo = {
"doctype": "ToDo",
"subject": subject,
"description": description,
"assigned_by": assigned_by,
}
return frappe.get_doc(todo).insert()
29 changes: 23 additions & 6 deletions frappe/desk/doctype/todo/todo.json
@@ -1,5 +1,6 @@
{
"actions": [],
"allow_rename": 1,
"autoname": "hash",
"creation": "2012-07-03 13:30:35",
"doctype": "DocType",
Expand All @@ -8,6 +9,7 @@
"engine": "InnoDB",
"field_order": [
"description_and_status",
"subject",
"status",
"priority",
"column_break_2",
Expand All @@ -32,6 +34,15 @@
"fieldtype": "Section Break"
},
{
"bold": 1,
"fieldname": "subject",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Subject",
"reqd": 1
},
{
"columns": 1,
"default": "Open",
"fieldname": "status",
"fieldtype": "Select",
Expand All @@ -42,6 +53,7 @@
"options": "Open\nClosed\nCancelled"
},
{
"columns": 1,
"default": "Medium",
"fieldname": "priority",
"fieldtype": "Select",
Expand All @@ -62,8 +74,10 @@
"label": "Color"
},
{
"columns": 1,
"fieldname": "date",
"fieldtype": "Date",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Due Date",
"oldfieldname": "date",
Expand All @@ -77,11 +91,11 @@
"fieldname": "description",
"fieldtype": "Text Editor",
"in_global_search": 1,
"in_list_view": 1,
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Text",
"print_width": "300px",
"reqd": 1,
"width": "300px"
},
{
Expand Down Expand Up @@ -152,16 +166,18 @@
"in_global_search": 1,
"in_standard_filter": 1,
"label": "Allocated To",
"options": "User"
"options": "User",
"search_index": 1
}
],
"icon": "fa fa-check",
"idx": 2,
"links": [],
"modified": "2021-09-16 11:36:34.586898",
"modified": "2023-10-06 04:35:19.319766",
"modified_by": "Administrator",
"module": "Desk",
"name": "ToDo",
"naming_rule": "Random",
"owner": "Administrator",
"permissions": [
{
Expand All @@ -188,12 +204,13 @@
}
],
"quick_entry": 1,
"search_fields": "description, reference_type, reference_name",
"search_fields": "subject, description, reference_type, reference_name",
"sender_field": "sender",
"sort_field": "modified",
"sort_order": "DESC",
"subject_field": "description",
"title_field": "description",
"states": [],
"subject_field": "subject",
"title_field": "subject",
"track_changes": 1,
"track_seen": 1
}
3 changes: 2 additions & 1 deletion frappe/desk/doctype/todo/todo.py
Expand Up @@ -26,13 +26,14 @@ class ToDo(Document):
assignment_rule: DF.Link | None
color: DF.Color | None
date: DF.Date | None
description: DF.TextEditor
description: DF.TextEditor | None
priority: DF.Literal["High", "Medium", "Low"]
reference_name: DF.DynamicLink | None
reference_type: DF.Link | None
role: DF.Link | None
sender: DF.Data | None
status: DF.Literal["Open", "Closed", "Cancelled"]
subject: DF.Data
# end: auto-generated types
DocType = "ToDo"

Expand Down
4 changes: 2 additions & 2 deletions frappe/desk/doctype/todo/todo_calendar.js
Expand Up @@ -6,8 +6,8 @@ frappe.views.calendar["ToDo"] = {
start: "date",
end: "date",
id: "name",
title: "description",
allDay: "allDay",
title: "subject",
allDay: 1,
progress: "progress",
},
gantt: true,
Expand Down