From 10bd9a7efd7389ae0457ff53cc90e5a1044cc5cd Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:36:53 +0100 Subject: [PATCH] fix: use communication date in timeline Before, we used the database creation date, which coincidentally corresponds to the real communication date in many cases. --- frappe/desk/form/load.py | 4 ++-- frappe/public/js/frappe/form/footer/form_timeline.js | 2 +- .../js/frappe/form/templates/timeline_message_box.html | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frappe/desk/form/load.py b/frappe/desk/form/load.py index d3c448fa03..d983cf96bc 100644 --- a/frappe/desk/form/load.py +++ b/frappe/desk/form/load.py @@ -287,7 +287,7 @@ def get_communication_data( if after: # find after a particular date conditions += f""" - AND C.creation > {after} + AND C.communication_date > {after} """ if doctype == "User": @@ -319,7 +319,7 @@ def get_communication_data( SELECT * FROM (({part1}) UNION ({part2})) AS combined {group_by} - ORDER BY creation DESC + ORDER BY communication_date DESC LIMIT %(limit)s OFFSET %(start)s """.format(part1=part1, part2=part2, group_by=(group_by or "")), diff --git a/frappe/public/js/frappe/form/footer/form_timeline.js b/frappe/public/js/frappe/form/footer/form_timeline.js index 78188f64f1..57acf85f7c 100644 --- a/frappe/public/js/frappe/form/footer/form_timeline.js +++ b/frappe/public/js/frappe/form/footer/form_timeline.js @@ -234,7 +234,7 @@ class FormTimeline extends BaseTimeline { communication_timeline_contents.push({ icon: icon_set[medium], icon_size: "sm", - creation: communication.creation, + creation: communication.communication_date, is_card: true, content: this.get_communication_timeline_content(communication), doctype: "Communication", diff --git a/frappe/public/js/frappe/form/templates/timeline_message_box.html b/frappe/public/js/frappe/form/templates/timeline_message_box.html index e6de6c9c6b..830e4cd39f 100644 --- a/frappe/public/js/frappe/form/templates/timeline_message_box.html +++ b/frappe/public/js/frappe/form/templates/timeline_message_box.html @@ -23,7 +23,7 @@ {% } %}
- {{ comment_when(doc.creation) }} + {{ comment_when(doc.communication_date) }}
{% } else if (doc.comment_type && doc.comment_type == "Comment") { %} @@ -33,7 +33,7 @@ {{ __("commented") }} . - {{ comment_when(doc.creation) }} + {{ comment_when(doc.communication_date) }} {% } else { %} @@ -44,7 +44,7 @@ {{ doc.user_full_name || frappe.user.full_name(doc.owner) }} . - {{ comment_when(doc.creation) }} + {{ comment_when(doc.communication_date) }} {% if (doc.subject) { %}
{{doc.subject}}