|
@@ -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): |
|
|