Quellcode durchsuchen

[minor] don't update the parent's status to Replied on Communication Update (#4266)

version-14
Makarand Bauskar vor 7 Jahren
committed by Rushabh Mehta
Ursprung
Commit
ad596b56d7
2 geänderte Dateien mit 5 neuen und 18 gelöschten Zeilen
  1. +2
    -2
      frappe/core/doctype/communication/communication.py
  2. +3
    -16
      frappe/core/doctype/communication/email.py

+ 2
- 2
frappe/core/doctype/communication/communication.py Datei anzeigen

@@ -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, from frappe.core.doctype.communication.comment import (notify_mentions,
update_comment_in_doc, on_trash) update_comment_in_doc, on_trash)
from frappe.core.doctype.communication.email import (validate_email, 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.bot import BotReply
from frappe.utils import parse_addr from frappe.utils import parse_addr


@@ -95,7 +95,7 @@ class Communication(Document):
def on_update(self): def on_update(self):
"""Update parent status as `Open` or `Replied`.""" """Update parent status as `Open` or `Replied`."""
if self.comment_type != 'Updated': if self.comment_type != 'Updated':
update_parent_status(self)
update_parent_mins_to_first_response(self)
update_comment_in_doc(self) update_comment_in_doc(self)
self.bot_reply() self.bot_reply()




+ 3
- 16
frappe/core/doctype/communication/email.py Datei anzeigen

@@ -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 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() parent = doc.get_parent_doc()
if not parent: if not parent:
return 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 # ignore in case of only Comment is added
if doc.communication_type == "Comment": if doc.communication_type == "Comment":
return 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) update_mins_to_first_communication(parent, doc)
parent.run_method('notify_communication', doc) parent.run_method('notify_communication', doc)

parent.notify_update() parent.notify_update()


def get_recipients_and_cc(doc, recipients, cc, fetched_from_email_account=False): def get_recipients_and_cc(doc, recipients, cc, fetched_from_email_account=False):


Laden…
Abbrechen
Speichern