Skip to content
Snippets Groups Projects
user avatar
Thibault Delavallée authored
Incoming email servers have an action_id field holding a server action to
run on newly created records. It comes from old implementation of mail
gateways in Odoo. Since then mail gateway has evolved. Incoming mail servers
are not linked to a unique model anymore. With aliases and automatic thread
creation mails can create records in various models.

As the server action is bound to a given model it causes issues. Either
we have to give back the result of the mail gateway processing to ensure
models match. Either we have to limit action_id to records created
using the "default model behavior" of incoming mail servers.

We choose to remove this field. Same result can be achieved with an
automated action running on create trigger. If exactly the same
behavior is intended the following rules should be applied

 * add automated action with model linked to the one you want to
   update depending on alias configuration and work flow;
 * set trigger to create;
 * set action as python;
 * if it is necessary to be linked to the mail gateway, check in
   record message_ids that there is a message with message_type
   being 'email' meaning it has received an incoming email;

Using that heuristic migrating existing fetchmail action to server actions
should be quite straightforward and will give more flexibility.

This commit is linked to task ID 58641. Closes #23621 .
8c472b7b
History
Name Last commit Last update