From ad596b56d789943a83d71548a50e77b2642a0f1a Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Mon, 9 Oct 2017 13:16:25 +0530 Subject: [PATCH] [minor] don't update the parent's status to Replied on Communication Update (#4266) --- .../doctype/communication/communication.py | 4 ++-- frappe/core/doctype/communication/email.py | 19 +++---------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/frappe/core/doctype/communication/communication.py b/frappe/core/doctype/communication/communication.py index d259b60cbd..5a63381d91 100644 --- a/frappe/core/doctype/communication/communication.py +++ b/frappe/core/doctype/communication/communication.py @@ -9,7 +9,7 @@ from frappe.utils import validate_email_add, get_fullname, strip_html, cstr from frappe.core.doctype.communication.comment import (notify_mentions, update_comment_in_doc, on_trash) from frappe.core.doctype.communication.email import (validate_email, - notify, _notify, update_parent_status) + notify, _notify, update_parent_mins_to_first_response) from frappe.utils.bot import BotReply from frappe.utils import parse_addr @@ -95,7 +95,7 @@ class Communication(Document): def on_update(self): """Update parent status as `Open` or `Replied`.""" if self.comment_type != 'Updated': - update_parent_status(self) + update_parent_mins_to_first_response(self) update_comment_in_doc(self) self.bot_reply() diff --git a/frappe/core/doctype/communication/email.py b/frappe/core/doctype/communication/email.py index c17ac1f5c8..33f7e680c4 100755 --- a/frappe/core/doctype/communication/email.py +++ b/frappe/core/doctype/communication/email.py @@ -164,32 +164,19 @@ def _notify(doc, print_html=None, print_format=None, attachments=None, is_notification=True if doc.sent_or_received =="Received" else False ) -def update_parent_status(doc): - """Update status of parent document based on who is replying.""" +def update_parent_mins_to_first_response(doc): + """Update mins_to_first_communication of parent document based on who is replying.""" parent = doc.get_parent_doc() if not parent: return - # update parent status only if we create the Email communication + # update parent mins_to_first_communication only if we create the Email communication # ignore in case of only Comment is added if doc.communication_type == "Comment": return - status_field = parent.meta.get_field("status") - - if status_field: - options = (status_field.options or '').splitlines() - - # if status has a "Replied" option, then update the status - if 'Replied' in options: - to_status = "Open" if doc.sent_or_received=="Received" else "Replied" - - if to_status in options: - parent.db_set("status", to_status) - update_mins_to_first_communication(parent, doc) parent.run_method('notify_communication', doc) - parent.notify_update() def get_recipients_and_cc(doc, recipients, cc, fetched_from_email_account=False):