EMS

Conversations on a contact’s chatter and their answers by email

A message written on a student’s or a family’s chatter is a conversation between whoever writes it and the contact (issue #586). Two things decide who else gets it: the record’s followers, and where an answer sent by email ends up.

sequenceDiagram
    participant T as Teacher
    participant E as EMS (chatter)
    participant F as Family
    T->>E: Writes a message on the student's chatter
    Note over E: The teacher becomes a follower
    E->>F: Email, Reply-To = the answers address
    F->>E: Answers by email
    Note over E: Incoming mail server reads the answers mailbox
    E->>E: Answer filed on the student's chatter
    E->>T: Notified as a follower

Followers

Answers by email

Odoo files an answer on the record it belongs to when an incoming mail server reads the mailbox the answer arrives at. That needs configuration in production, not code:

  1. An address for answers that is not the bounce address. In the alias domain (Settings > Technical > Email > Alias Domains) the catchall alias is the Reply-To of every chatter message and the bounce alias receives the delivery failures. Odoo discards as a bounce whatever arrives at the bounce address, before looking at what it answers: with both set to the same name no answer is ever filed. Use a mailbox of its own for the catchall.
  2. An incoming mail server (Settings > Technical > Email > Incoming Mail Servers) reading that mailbox, with no “create a new record” action: only answers are wanted.
  3. The scheduled action “Mail: Fetchmail Service” active.

What to expect from it:

Direct notices (message_notify()) and templates with their own reply_to do not go through this: their answers go straight to a person.

The same circuit carries meetings held by email: a meeting minute with the modality “By email” is a thread whose answers are written into the minute (see quality_overview.md).

Development machines

A database restored from production carries production’s incoming mail server. An email is fetched once, so reading that mailbox from a development machine would take the answers away from production. fetchmail.server.fetch_mail() does nothing when ems_server_role = dev (models/settings/mail_guard.py), and devel.sh switches the incoming servers off.

Tests

tests/test_student_chatter_replies.py: followers on creation and on writing, the administrator clean-up, an emailed answer routed through message_process() to the contact’s chatter and to whoever wrote, and the development-machine guard.