From ac8650d48611037c23a6cf8867a51683d988a426 Mon Sep 17 00:00:00 2001 From: Neel Bhanushali Date: Mon, 6 May 2024 20:26:07 +0530 Subject: [PATCH 1/3] added automated_messages from communications to activites --- crm/api/activities.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/crm/api/activities.py b/crm/api/activities.py index 3cd9e9f3..c9f88262 100644 --- a/crm/api/activities.py +++ b/crm/api/activities.py @@ -129,6 +129,25 @@ def get_deal_activities(name): } activities.append(activity) + for communication in docinfo.automated_messages: + activity = { + "activity_type": "communication", + "creation": communication.creation, + "data": { + "subject": communication.subject, + "content": communication.content, + "sender_full_name": communication.sender_full_name, + "sender": communication.sender, + "recipients": communication.recipients, + "cc": communication.cc, + "bcc": communication.bcc, + "attachments": get_attachments('Communication', communication.name), + "read_by_recipient": communication.read_by_recipient, + }, + "is_lead": False, + } + activities.append(activity) + calls = calls + get_linked_calls(name) notes = notes + get_linked_notes(name) tasks = tasks + get_linked_tasks(name) @@ -241,6 +260,25 @@ def get_lead_activities(name): } activities.append(activity) + for communication in docinfo.automated_messages: + activity = { + "activity_type": "communication", + "creation": communication.creation, + "data": { + "subject": communication.subject, + "content": communication.content, + "sender_full_name": communication.sender_full_name, + "sender": communication.sender, + "recipients": communication.recipients, + "cc": communication.cc, + "bcc": communication.bcc, + "attachments": get_attachments('Communication', communication.name), + "read_by_recipient": communication.read_by_recipient, + }, + "is_lead": True, + } + activities.append(activity) + calls = get_linked_calls(name) notes = get_linked_notes(name) tasks = get_linked_tasks(name) From ed1081d718f8ad7cb458f00462f2ac16dbc0bd25 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 13 May 2024 15:53:01 +0530 Subject: [PATCH 2/3] fix: remove duplicate code --- crm/api/activities.py | 42 ++---------------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/crm/api/activities.py b/crm/api/activities.py index c9f88262..9079d47f 100644 --- a/crm/api/activities.py +++ b/crm/api/activities.py @@ -110,26 +110,7 @@ def get_deal_activities(name): } activities.append(activity) - for communication in docinfo.communications: - activity = { - "activity_type": "communication", - "creation": communication.creation, - "data": { - "subject": communication.subject, - "content": communication.content, - "sender_full_name": communication.sender_full_name, - "sender": communication.sender, - "recipients": communication.recipients, - "cc": communication.cc, - "bcc": communication.bcc, - "attachments": get_attachments('Communication', communication.name), - "read_by_recipient": communication.read_by_recipient, - }, - "is_lead": False, - } - activities.append(activity) - - for communication in docinfo.automated_messages: + for communication in docinfo.communications + docinfo.automated_messages: activity = { "activity_type": "communication", "creation": communication.creation, @@ -241,26 +222,7 @@ def get_lead_activities(name): } activities.append(activity) - for communication in docinfo.communications: - activity = { - "activity_type": "communication", - "creation": communication.creation, - "data": { - "subject": communication.subject, - "content": communication.content, - "sender_full_name": communication.sender_full_name, - "sender": communication.sender, - "recipients": communication.recipients, - "cc": communication.cc, - "bcc": communication.bcc, - "attachments": get_attachments('Communication', communication.name), - "read_by_recipient": communication.read_by_recipient, - }, - "is_lead": True, - } - activities.append(activity) - - for communication in docinfo.automated_messages: + for communication in docinfo.communications + docinfo.automated_messages: activity = { "activity_type": "communication", "creation": communication.creation, From 03e52c34e1f7db319878b6b3d4afbbd619d42372 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 13 May 2024 15:56:06 +0530 Subject: [PATCH 3/3] fix: show notification badge if email came from notification --- crm/api/activities.py | 2 ++ frontend/src/components/Activities.vue | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/crm/api/activities.py b/crm/api/activities.py index 9079d47f..ead84b1f 100644 --- a/crm/api/activities.py +++ b/crm/api/activities.py @@ -113,6 +113,7 @@ def get_deal_activities(name): for communication in docinfo.communications + docinfo.automated_messages: activity = { "activity_type": "communication", + "communication_type": communication.communication_type, "creation": communication.creation, "data": { "subject": communication.subject, @@ -225,6 +226,7 @@ def get_lead_activities(name): for communication in docinfo.communications + docinfo.automated_messages: activity = { "activity_type": "communication", + "communication_type": communication.communication_type, "creation": communication.creation, "data": { "subject": communication.subject, diff --git a/frontend/src/components/Activities.vue b/frontend/src/components/Activities.vue index a0e4f6e6..3d9e743f 100644 --- a/frontend/src/components/Activities.vue +++ b/frontend/src/components/Activities.vue @@ -386,6 +386,12 @@ {{ __(timeAgo(activity.creation)) }} +
@@ -834,6 +840,7 @@ import { Dropdown, TextEditor, Avatar, + Badge, createResource, call, } from 'frappe-ui'