Commit Graph
52 Commits
Author SHA1 Message Date
Thibault Delavallée a69c2bab0a [FIX] mail, mail_channel: recipients of channels
Mailing lists (mail.channel) should not send specific notification emails.
Indeed there can be a lot of recipients and customizing each email can
take time to compute. This leads to posting a message on a mail.channel
being very slow.

It is now possible for a model to customize the notification email
recipients computation. The first use is to ensure that mail.channel
encodes recipients using email_to instead of recipients_ids. This way
less processing is performed on notification emails.

This is a manual cherry-pick of commit d4a1eb4435
that was not forard ported. Mail has indeed evolved since 8.0 and its
forward port was not an easy task.

This commit also includes the fix of mail.channel recipients. All are now
considered as equal and receive a simple notification email. No distinction
is done between partners and users. The notification emails for channels
should be as simple as possible.
2016-01-08 16:40:40 +01:00
Géry Debongnie 739301be09 [FIX] mail: add link to urls clientside, not serverside
the server should avoid as much as possible modifying emails.  Adding
links is a presentation concern, so this commit moves this logic client
side.
2016-01-08 15:02:22 +01:00
Aaron Bohy 17896a92da [FIX] mail: various ui improvements/fixes
* chat windows:
  - input was kicked out of the window on chrome 43
  - don't animate if folded by default (e.g. after a refresh)
  - width and height 100% like in the frontend
  - z-index to make sure that they are over bootstrap active btn,
    but below notifications, and modals

* chatter:
  - internal note: send button renammed to 'Log'
  - send button is the first button again
  - remove annoying form view widget's tooltip

* client action: focus on composer on channel change
2015-12-15 10:01:21 +01:00
Olivier Dony 3d32e99665 [FIX] mail.thread: optimize lookup of res.users by email
Searching on res.partners with domain [('user_ids' , '!=', False)]
will currently be translated into a huge "ID IN <...>"  query,
with the IDs of all existing users.
On a database with a lot of users, this can be measured
in seconds (e.g. 3-4 seconds with 500k+ users),
leading to significant delays in email delivery.

Using a direct lookup in res.users is more direct and faster.
2015-12-10 18:43:17 +01:00
Thibault Delavallée f7c0480dc1 [FIX] mail: fix 504227cca9
Do not restrict followers-based alias to members of non public channels.
Otherwise you may have issues defining a public mailing list with a
subscription step. People still wouldn't be able to post on a public
channel using a restricted alias.
2015-12-09 09:59:04 +01:00
Thibault Delavallée e7f842948f [FIX] website_mail_channel: wrong override
message_get_email_values is declared as receiving cr, uid, id. However this method
is an override of a multi method. A decorator has been added to tell that id is
actually a list of ids and avoid list encapsulation issues with the result. This
way the method parameters are not changed.

[CLEAN] mail: removed some unused imports, by the way
2015-12-08 16:33:54 +01:00
Thibault Delavallée 504227cca9 [FIX] mail: followers restricted alias
Now that channels can follow documents, restricted aliases are a bit too
restricted. We consider that followers-based aliases accept emails from
the direct followers (message_partner_ids) or member of non public
channels (message_channel_ids, filetered public field). This way we avoid
having public channels added by mistake, leading to information leak.
2015-12-08 16:33:49 +01:00
Thibault Delavallée 870c822ac5 [FIX] mail: incoming email parsing
Correctly flag and remove nodes to remove containing odoo buttons.

Backport of revision aece706603 of saas7.
2015-11-18 17:23:26 +01:00
Denis Ledoux 49a0eae805 [FIX] mail: mails fetch
`node.get('class', '')` returns a `Nonetype`
in some cases, and, therefore,
`'o_mail_notification' in node.get('class', '')`
throws a
`TypeError: argument of type 'NoneType' is not iterable`.

Replacing by `(node.get('class') or '')` keep the behavior
that was expected, but will prevent to have a `Nonetype`

opw-656508
opw-656753
opw-653965
2015-11-18 17:02:13 +01:00
Denis Ledoux c2a6aeb244 [FIX] mail: internal subtypes with special characters
The fields options in the form are evaluated with
a `py_eval`, see:
https://github.com/odoo/odoo/blob/3c2e48423b4f9706216cada549d0a725f2dd07d2/addons/web/static/src/js/views/form_common.js#L664,
not as a JSON.

This was changed in October 2012, with rev.
c538db258a

Therefore, the field options must not be passed as a JSON, but
as a Python dict.

This had as side-effect to uncorrectly load the internal
subtypes for the "log a note" feature. For instance,
French translations with accents were displayed incorrectly.

opw-656409
2015-11-16 16:38:54 +01:00
Thibault Delavallée 9b385078b2 [DOC] mail: add some docstrings for mail context keys
Too much keys kills keys. Difficult to say.
2015-10-26 10:54:19 +01:00
Thibault Delavallée a36de1efad [FIX] mail: notification email cleaning
- remove / udpate some paddings. Indeed some part of the notification emails
  are badly aligned.
- postprocess the notification email to remove the content coming from odoo.
  This ensure that action buttons present in some emails are not forwarded to
  other people, notably customers. This is done by adding a div holding the
  whole notification emails, with a summary = o_mail_notification. A summary
  is used instead of a class or id because some html clients (like gmail)
  strip classes, ids, ... summary seems to be kept in several clients.
2015-10-26 10:28:46 +01:00
Géry Debongnie 1a4b24586d [FIX] mail: disable message_last_post to prevent race conditions
The message_last_post mechanism was introduced to have a trigger for
automated actions, but for some reason we do not use it.  Moreover, it
interacts badly with the bus.

Because of the message_last_post update, concurrent transactions can
fail and be rollbacked.  This is an issue because the bus commit the
transaction after writing the messages.  This means that some messages
can be duplicated, and the more users are chatting, the more frequent
this will happen.

Since we don't use this field, it could be removed from the models, but
we are in a stable release, so we need to keep it for now.
2015-10-14 09:17:04 +02:00
Nicolas Martinelli db68f9c4be [FIX] mail, project: define search method for message_is_follower
In order to be able to search on a non-stored computed field, a search
method must be defined.

This also reverts commit fd38fc0a02.

Fixes #8920
2015-10-13 10:15:21 +02:00
Jérome Maes b1849f532e [FIX] mail : posting message with mention and clickable url
Posting message is done in 'html' since mention add html tag in body. Clickable url is done server to allow link in mail and chat message. Plaintext are transform into html, and html message are simply parsed to transform url into clickable link.
2015-10-07 16:37:11 +02:00
Thibault Delavallée 17e562ecef [FIX][TESTS] mail: auto subscription, needaction
- fixed computation of needaction flag (typo)
- fixed order of auto subscription and message tracking: first subscribe then
  track. This way messages are send to newly added followers.
- added tests in CRM to ensure this behavior works by updating the already
  existing test and using the mail test class
2015-10-05 11:56:05 +02:00
Thibault Delavallée 803bf8f75d [IMP] mail: invite email, notification style
Use the notification template when sending invite emails (add a follower
with send a message checked).
2015-10-05 11:56:05 +02:00
Christophe Simonis d750206c49 [MERGE] forward port of branch saas-6 up to e9f1ee4 2015-10-01 15:16:59 +02:00
Leonardo Rochael Almeida 60af7cac02 [IMP] replace simplejson with stdlib json
The stdlib version of the json library is more recent than the 3.5.3
version we are pinning in `requirements.txt`

There is no reason to use it.

Closes #6940
2015-09-28 10:53:32 +02:00
Thibault Delavallée 396c5db41a [FIX] mail, various: buttons in notifications
Various fixes :
- new button (task / issue / note) param name + correct action
- method button fix
2015-09-22 10:28:01 +02:00
Jérome Maes 83f15283bf [FIX] mail : fix needaction generation
When creating a document a message is posted (ex: 'document created') and the track field users are auto added as follower and notified with the last posted message (like the just create message). So the author was notify of the creation of its own document.

The problem did not appears using form view, beacause when the mail.message were reloaded, the thread was mark as read, so the partner (author/creator) was directly removed from the needaction_partner_ids field. The issue happen when loading the demo data, generating many needaction for the admin user (creator of most of the document).

This bugfix remove the current partner from the new follower to subscribe and to notify with the last posted message, as done when a message is posted (in _notify method of mail.message).
2015-09-18 11:50:29 +02:00
Martin Trigaux 38026134b1 [IMP] mail: better field label
Needaction is definitely too technical
2015-09-17 17:26:16 +02:00
Nicolas Martinelli a6d773773d [FIX] mail: empty notes and field monetary
We prevent the creation of empty notes and add the field monetary in the
list of accepted fields.
2015-09-10 10:09:58 +02:00
Jérome Maes 7674536713 [IMP] mail : message_post_with_template helper
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 !
2015-09-04 15:55:38 +02:00
Géry Debongnie a134a6988f [IMP] mail: rename references to 'slack' in 'chat' + webicon
use the old chat webicon
2015-09-01 20:58:11 +02:00
Géry Debongnie 2cfb915f25 [FIX] mail: use correct redirect action
The redirect action to the inbox was removed, but the tests (and the default action
method) need to be updated.
2015-09-01 20:58:10 +02:00
Jérome Maes 449f254638 [REF] mail : include real time, and replace Timeline features
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
2015-09-01 20:16:09 +02:00
Gaurav Panchal bb1200adc7 [IMP] project, project_issue : email cc set follower
Partner is created on the fly if it didn't exist yet.
2015-09-01 08:13:53 +02:00
Thibault Delavallée 01ab75f597 [IMP] mail: notification emails with button
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.
2015-08-28 17:30:42 +02:00
Thibault Delavallée 14dea96a4e [FIX mail: decorator issue
A method was designed to work in multi, but used sometimes as model
and sometimes as one.
2015-08-28 15:15:35 +02:00
Thibault Delavallée 88b8cd0587 [REF] mail: model update for NewChatter
Main changes :
- mail.notification model is removed. People do not receive notifications
anymore. Instead two ways of following documents exist
  - using a channel; messages will be displayed on the channel itself
  in a near future commit
  - following with its partner; messages will all be considered as
  needaction, using a new m2m table. People should receive less
  needaction messages by following less records by themselves.
There is no more read / unread state anymore. Instead only needaction
messages are considered. Todo (Favorites) messages still exist, and are
stores on a new m2m table instead of using decorated notifciations.
- the main filter for documents is not message_unread anymore, but
message_needaction. A lot of views and filters have been updated
accordingly.
- the vote feature has been removed
2015-08-21 12:11:56 +02:00
Thibault Delavallée e6f038a821 [REF] mail: mail_thread: followers update
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.
2015-08-21 12:11:56 +02:00
Thibault Delavallée 9f844c570f [REM] mail, calendar: removed dead code (unused method and its
override, unused variables; duplicated code; commented code)
2015-08-06 10:06:18 +02:00
Antony Lesuisse e7e452f38c [IMP] ir.ui.menu more cleanups
- remove deprecated tree_but_open ir.values
- remove magic ir_ui_menu delete at loading
- remove unused icon and web_icon_hover
2015-08-02 14:10:24 +02:00
Thibault Delavallée 924c54f24b [FIX] mail: followers computation: working on newId records
can lead to issues when trying to compute followers.

This case appears in the onchange mechanism. Indeed it may
manipulate temporary and/or new records, not having an
ID. In this case the computation of followers is not
necessary anymore.
2015-07-29 12:07:50 +02:00
Christophe Simonis 97073e2a73 [MERGE] forward port of branch saas-6 up to 51040b6 2015-07-28 13:56:16 +02:00
Christophe Simonis e182f19694 [FIX] *: various bug were introduced during last forward-port 2015-07-22 18:33:04 +02:00
Christophe Simonis 2cf91d16a5 [MERGE] forward port of branch saas-6 up to 63e92cb 2015-07-22 16:17:54 +02:00
qdp-odoo 330b1275c5 [REF] mail: refactored message_track for better inheritance possibilities + display body and tracked fields in the chatter if a message has both 2015-07-20 11:40:06 +02:00
Damien Bouvy 1a23506b4b [FIX] mail: forgotten context in new api migration 2015-07-17 09:57:09 +02:00
Raphael Collet b1915f506d [FIX] mail: fix method _get_default_author to return a recordset instead of an id 2015-07-11 03:00:40 +02:00
Thibault Delavallée 4a818d84a5 [REF] mail: mail.thread fields cleaning :
- removed message_summary, a field that computes html containing the number
of unread messages. This field was used only in kanban views. Probably that
in earlier versions of the kanban view this field had a use; however now
we can directly use a counter and use it in the kanban templates.
- message_unread_counter is added, a counter of unread messages computed
in the same time as message_unread. It is now used in kanban views.

Views of several addons have been updated.
2015-07-09 11:13:02 +02:00
Thibault Delavallée d931aa3825 [RENAME] mail, portal: updated actions and views xml ids
for channel-related stuff. mail.channel views as well as timeline views
and actions have been renamed. Now the names follow the guidelines and
will be used in the upcoming refactoring of mail and chat.
2015-07-09 11:13:02 +02:00
Thibault Delavallée 1c38e61c35 [REM] mail, hr: removed suggested groups / suggested employees feature.
Removed fields and code related to the display of groups and employee
suggestions. This impacts notably the model of res.users in mail and
hr.
2015-07-09 10:09:10 +02:00
Thibault Delavallée 9bd8c00b01 [IMP] mail: moved methods called by mail_followers.js to controllers,
updated their code accordingly.

Subtype display in the follower widget has been improved: now displaying correctly
subtypes ordered by related model, then internal / not internal, then sequence.
2015-07-02 13:33:59 +02:00
Thibault Delavallée 9cd9aaaa17 [IMP] mail: new internal-only subtype feature.
Starting from now, subtypes can be internal. This means that only employees
(group_user members) can see the messages with this subtype. This feature
replaces and enhances the 'log a note = no subtype = internal only'
feature.

Public and portal users cannot see internal messages. This allows to have
subtypes and a follow mechanism that works for employees and is not
visible for external people.

Its first use will be for Crm Activities, allowing to have custom
subtypes visible only for salesman and not send to the customer.
2015-07-01 12:52:52 +02:00
Thibault Delavallée a4d5cfa747 [IMP][FIX] mail, various: migrate fields_view_get override to the new API
(leftover of migration). However this implies some fixes in the various calls
to models inheriting from mail.thread. Indeed giving positional instead of
keyword argument creates issues in the wrapper between the old and new
API.

In account_analytic_plan, useless override of fields_view_get has been removed.
2015-06-29 13:16:11 +02:00
Christophe Simonis a304194936 [MERGE] forward port of branch saas-6 up to 81b5c60 2015-06-25 00:26:31 +02:00
Martin Geubelle e9834cd77b [IMP] mail: icons from unread and read messages were the same 2015-06-18 11:10:29 +02:00
Dipesh Suthar 94e441a2b5 [FIX] crm_project_issue: traceback on creation of issue from lead 2015-05-23 10:50:25 +02:00