def update_parent_status(doc):
 if (doc.communication_type != u'Communication'):
  return
 parent = doc.get_parent_doc()
 if (not parent):
  return
 status_field = parent.meta.get_field(u'status')
 if status_field:
  options = (status_field.options or u'').splitlines()
  if (u'Replied' in options):
   to_status = (u'Open' if (doc.sent_or_received == u'Received') else u'Replied')
   if (to_status in options):
    parent.db_set(u'status', to_status)
 update_mins_to_first_communication(parent, doc)
 parent.run_method(u'notify_communication', doc)
 parent.notify_update()

def update_parent_status ( doc ) : if ( doc . communication_type != u'Communication' ) : return parent = doc . get_parent_doc ( ) if ( not parent ) : return status_field = parent . meta . get_field ( u'status' ) if status_field : options = ( status_field . options or u'' ) . splitlines ( ) if ( u'Replied' in options ) : to_status = ( u'Open' if ( doc . sent_or_received == u'Received' ) else u'Replied' ) if ( to_status in options ) : parent . db_set ( u'status' , to_status ) update_mins_to_first_communication ( parent , doc ) parent . run_method ( u'notify_communication' , doc ) parent . notify_update ( )
update status of parent document based on who is replying .