The cache data format has been split between a cache format and a record format
(returned by accessing a field on a record). We have the following converters:
ANY FORMAT
|
| convert_to_cache
v
CACHE FORMAT
|
| convert_to_record
v
RECORD FORMAT
|
| convert_to_read
| convert_to_write
| convert_to_onchange
| convert_to_export
| convert_to_display_name
v
OTHER FORMATS
Modify the API of the converter methods to make them uniform (pass value and
record), and adapt their documentation.
For a message to be considered as a private message,
the message must have:
- `no_auto_thread` set to `False`
in other words, it must not be attached to a thread
- no `model` or `res_id` must be set on the message
meaning the message is not attached to a specific
record thread.
See `_get_message_id` in `mail/models/mail_message.py`.
Before this revision, the mails sent from
`Discuss` > `Send mail` were not regarded
as private messages,
but as a kind of mass mailing messages,
with a `reply-to` wrongly set.
Any attempt to reply to these mails
failed with a delivery failure notification.
This was because the `message-id` of these messages
contained `reply-to`, and such message-ids are
treated as a special case in the messages routing
(basically, the match on the mail references is disabled
for these messages containing `reply-to` in
their message-id).
opw-669241
When a specific SMTP server is set on a mail template, it is never used
when the mail is sent. There are two reasons:
- `mail_server_id` is a read-only field set by an onchange. However, a
read-only field is not sent to the server, so the information is lost.
- The information is stored in the context of the object `Mail`, but it
is never used. Moreover, when the method `message_post` is called, the
`Mail` object is not used to post the message, so the information is
lost again.
The fix includes two parts:
- the `mail_server_id` field is not read-only anymore. Actually, there
is no reason to make it read-only.
- the information is stored directly in the mail values and used at the
appropriate moment.
Fixes#6554 (from v9.0)
opw-669958
Use case: I can create a Channel on a chatter, for example on a task
If I choose create and edit, there's another window coming where I
can set up the Channel. In this situation I can't add any members.
But then as the channel is empty and I (as the creator) am not by default
in that channel, I can't find it in my Channels in Discuss...
Composer in mass mailing mode currently keeps a copy of the emails in the
document communication history (chatter). It is done by keeping the
mail_message that is used to create the mail_mail record. It is now possible
to customize this behavior. Using auto_delete_message one can choose to not
keep a copy of the sent emails.
Note that the notification field on the mail_mail is used to know if the
associated mail_message has to be unlinked when unlinking the mail_mail.
Auto deletion of sent emails is based on the option on the template used
to generate the emails. It is now possible to bypass the template behavior
if requested, using the auto_delete field in the composer. If this field
is not set, the previous behavior applies.
It is now also possible to tune the message_type and subtype_id of the
posted message. Previously all messages posted through the composer
were comments with a computed subtype being either a comment or a note.
Those values are now default values but can be changed in the wizard
and correctly taken into account when posting the message.
Those modification do not change anything in the default behavior of the
composer and templates. They are mainly introduced for use in future
improvements in various addons, like sending reminder emails that are
not stored.
Correctly set the auto delete property coming from the template in the composer.
Set the mail_auto_delete context key for message_post, and directly set the
auto_delete field value in mass mailing mode.
When selecting contacts from Contacts list views and clicking on
action window "Partner Mass Mailing", the 'active_domain' must be
filled in the wizard with the selecting contacts. In this way,
the right mailing_domain will be set when creating the related
mail.mass_mailing record (in addons/mass_mailing/wizard/mail_compose_message.py
in function get_mail_values).
opw:659383
When using a template adding the signature, do not re-add it when posting
the message on a document. For example the Sale Order - Send by Email
templates generated two signature in the email.
This issue has been introduced when migrating mail to the new API.
Use convert_to_cache and convert_to_read to format onchange values.
Fix: default value can be a command list, the onchange convert the comand list into a wrong comand list of command list.
The wizard is the same object, but to add channel as follower, some fields was not required. Via the 'mail_invite_follower_channel_only' context key, the unrelevant fields are hidden.
Create `message_post_with_template` helper method to factorize the simulation of a mail.compose.message wizard.
Also, fix the generated attachments of mail.compose.message wizard by returning ORM command (6, 0, ids) instead of the list of attachments ids. In order to standardize the behavior of the wizard, and since the ORM support command assignation in onchange api.v8, all the x2many fields of the wizard return a command.
FYI, that was tde's idea !
This commit add instant messaging features in mail module to make it a real team collaboration tool. Lots of these new features will replace Timeleine view (which is not removed in this commit). Many files have been moved, split or created for a better structure.
- My Channels : A user can be member of channel (mail.channel). These are discussion group, but also an aggregate of notification. Setting a channel as document follower, it will receive all the message (of the chatter) in real time, as information stream.
- A new Inbox : this aims to replace the timeline view. The user will see its channels grouped by 'slot', and receive the message in real time. Jump to the form view, invite people, create private discussion group, talk directly to another employee, ... are the main features. Your message can still be starred. The 'Inbox' will only contain your needaction.
- Needaction concept : a needaction is a message calling you to do something. If you follow a document as a person, the posted message will be 'needaction' for you. It can also be a message where you are mention with a '@my_name' (this feature is not added in this commit).
- The chatter doesn't change so much. It still allow you to see the discussion about the document, to star some message, and treat your needaction.
- Chat : the only way to have a minified conversation is from the Inbox Client Action. It allow you to keep an eye on a channel when working on document.
- Compose Message : it is now common to the Inbox, and the chatter. It offers shortcode substitution, attachments management, and optional subtype.
- UI : the chat window has been clean, they have a new look now.
To do so,
- Chatter code have been completely rewrite, independently of timeline view
- Add 'bus' as mail dependency, to insure real time
- A mail.message is broadcasted on the bus channel (db, mail.channel, channel_id), and a channel header on (db, res.partner, partner_id)
- Extracting mail_thread mixin used for Chatter and ChatMailThread (Inbox client action). This uniformize the programming structure with the server side
- Clean CSS style and use LESS instead of CSS
- Define a new messafe format (message_format method in mail_message.py), compatible with fetching and broadcasting
- Apply guideline coding conventions
This commit also break the module im_livechat, since im_chat models don't exists anymore and will be fixed in the next commit.
Thanks to Thibault Delavallee (tde) for the long debates and precious advices, Richard Mathot (rim) for the support, Simon Lejeune (sle) for the client action layout, and the Usability Team (apr, lle, bst yti) for the long testing.
Conflicts:
addons/mail/models/mail_thread.py
Notification emails have been redesigned. They notably include buttons
allowing to perform some action directly from the email.
The notification creation and sending has been partially rewritten
and improved. The purpose is to lessen the number of rendering to perform
when sending emails to recipients. Recipients are first categorized into
groups. Basic groups are partners and users. The notification template
is then rendered twice, one for followers and one for not-followers. In most
cases there will be few rendering to perform. Through inheritance it
is possible to further categorize users. For example HR users / officers
that have approve / refuse buttons in their email.
A custom data structure is used to store data about buttons and actions.
URLs, follow / unfollow are added in the structure and used in the
template to render the email for a given group.
New routes are added in mail. Those allow to perform some action, like
going to a form in create mode, following / unfollowing, executing a method,
sending a signal for a workflow. Those routes are for users only and rely
on classic access rights.
A generic route for viewing records is added. It replaces the old redirect
action. According to some specific action given by the already-existing
get_access_action, the record will be visible for everybody (forum, blog)
or restricted (going on the Inbox / login / form view, according to access
rights).
The next commit will add the various inherits necessary to add the actions
in the main addons.
Followers can now be partners or channels. Partners following a document
will receive needaction, as previously. However people can follow documents
through channels. Members of a channel are able to listen to a stream
of messages using the channel. Those messages do not create needaction
messages. It is therefore possible to follow documents without receiving
too much notifications. For interesting documents subscribing with its
partner will create notification.
message_follower_ids fields is udpated. It is now a many2many to
mail.followers, not to res.partner anymore. A subscription can be either
a partner (partner_id) or a channel (channel_id).
Some access rules have been updated accordingly.
Move the notification management from mail.notification to res.partner model.
Those methods belong more to the partner model, as they work on partners.
Moreover with the upcoming new model for NewChatter notification will be
heavily refactored.
- Preserved explicit 3rd-party copyright notices
- Explicit boilerplate should not be necessary - copyright law applies
automatically in all countries thanks to Berne Convention + WTO rules,
and a reference to the applicable license is clear enough.