Commit Graph
192 Commits
Author SHA1 Message Date
Didier (did) 1afcc9c368 [IMP] bus, mail, *: improve longpolling bus notification format
* = auth_signup, calendar, im_livechat, snailmail_account, survey, test_mail,
    web_editor, website_crm_iap_reveal, website_livechat

The aim of this PR is to improve/fix various flaws and limitation of the current
API, to make it easier to use and more efficient.

Notification are now defined with 3 distinct parts:

- the channel determines which client(s) should receive it
- the type determines how it should be handled
- the payload determines any extra information helpful for handling it

Channel
=======

Business code
-------------

- Record channel is introduced for ease of subscribing to and sending
  notifications to specific partners, channels, documents, ...
- String channel is still supported (but it is converted internally to the tuple
  channel).
- Tuple channel is still supported without any change (but should be avoided
  whenever possible due to its complex syntax).

The channel is no longer sent to the client. When the channel was used for
business purpose, the information it contained has been moved into either the
new type, or the payload itself.

Technical note
--------------

All channels are now internally converted to the tuple (db, ...) channel, which
is necessary for the platform code (saas/sh).

Internally, the bus.bus table is not changed, type and payload are grouped
together into what was (and still is) called message.

Type
====

Type is introduced to uniformize the way notifications are sent and handled.
All existing notifications already had some kind of manually-built type in them.
This is now officially supported at the bus API.

In client code this will allow (to be done in future commits) to register one
handler per specific type, instead of having to iterate and to filter all
received notifications on every handler.

Payload
=======

Payload (ex message) did not change, it can still be anything depending on
business needs.

Few adaptations:
- When the type was included on the payload, the type has been moved to the new
  type parameter.
- When the channel was used in business code, its data has been copied into the
  payload.

task-1891151

closes odoo/odoo#79201

X-original-commit: 543af27c7d6836ffac9e80ff8490b6ddbd849221
Related: odoo/enterprise#21998
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-29 16:05:23 +00:00
Thanh Dodeur c24f476538 [FIX] mail: prevent the server from sending outdated session state
Before this commit, the server could return outdated information to the
client about the state of their own rtc session.

The server should not return information about the client's own rtc
session as the source of truth is the client-side state.

A case in which this was causing an issue was when a user toggled their
mute state right before their client pinged the server and received
outdated session information before their most recent state could be
sent to the server.

This commit fixes this issue.

closes odoo/odoo#78028

X-original-commit: fe991edd2bca98b58fc5a49494871475c79bc22f
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-08 16:08:57 +00:00
Samuel Degueldre ceea5f7852 [IMP] mail: allow users to reply to other messages in discuss
This commit adds a feature where users can reply to messages of other
users, doing this will show a reduced version of the message that has
been replied to above the message once posted, clicking on this reduced
version will scroll to the original message and highlight it if that
message is already loaded.

task-2362251

closes odoo/odoo#77941

X-original-commit: cec2e69e832072dd699274187ddfa122e29d03f3
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Samuel Degueldre <sdegueldre@users.noreply.github.com>
2021-10-06 07:03:59 +00:00
Didier (did) f56d11e45b [FIX] mail: add attachment deleted notification
Before this commit, when an attachment is deleted, there is no notification and
other client do not update the attachment status.

task-2635516

closes odoo/odoo#77937

X-original-commit: aa4d7920574852d0543e22a30fc686a7d41f9867
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-06 02:09:07 +00:00
Louis Wicket (wil) 71f6d736cc [IMP] mail: add rename guest button
This commit will display the name of the current guest in the thread
view top bar and make it editable.

closes odoo/odoo#77936

X-original-commit: 659c6a83245a396054cf26c204a7fc72fbbb971f
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-06 02:09:03 +00:00
Louis Wicket (wil) 3ffad9f8a0 [FIX] mail: open attachment viewer in public views
Click on an attachment from a public thread view will now open it in an
attachment viewer.

closes odoo/odoo#77932

X-original-commit: 550dc40b022cd3b11440a1767df4d857d9fd12a9
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-06 02:08:59 +00:00
Louis Wicket (wil) b07b123145 [IMP] mail: notify guest arrival
Post a message in the channel each time a guest is added to members of
the channel.

closes odoo/odoo#77915

X-original-commit: bf6af9b629a07d04bf582987b5144a37fa31729e
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-05 18:05:42 +00:00
Sébastien Theys 2f700dd9a7 [FIX] mail, *: avoid concurrency issue of RTC sessions
* = test_discuss_full

Before this commit if 2 persons are joining the call at the exact same time, the
join RPC of each will return the list of RTC sessions without the other person
included.

In more general terms, the server should actually rarely send the full state to
the JS (in this case "use the replace command") because there is no guarantee
that a concurrent transaction is not changing the data at the same time. In
other words, even the python is actually working with partial knowledge
relatively to the database.

Using a DB lock would guarantee it, but we don't want to lock tables and wait on
locks if there are alternatives. In this case it is acceptable to keep obsolete
sessions for a little bit longer, as long as they are cleared eventually.

closes odoo/odoo#77656

X-original-commit: d3a84172fc78f5783f75aa1155f1a25e4f9614b7
Signed-off-by: Samuel Degueldre <sdegueldre@users.noreply.github.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-04 09:16:19 +00:00
Louis Wicket (wil) 640fa1d1c3 [FIX] mail: ensure guest is in the context
Update a specific flow to ensure the record on which session_info is
called has guest in its context. This is needed because session_info
performs some checks on guest to determine if it should add translations
data.

closes odoo/odoo#77433

X-original-commit: bd0940cdbf43131ed8436a5deb3f8afebfbc37ab
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-01 10:09:42 +00:00
Louis Wicket (wil) 985b7f37d7 [IMP] mail: merge welcome and thread views
This commit will merge welcome and thread views in the same route and
template. The aim is to make the user interacting with the page (by
landing them on the welcome view first) so that the browser allows the
page to play audio and to switch to full screen.

closes odoo/odoo#77381

X-original-commit: 97ed683e3e7cc6b340bb78c4faa01a703a573f32
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-30 17:11:46 +00:00
Sébastien Theys bdbcf51bf4 [IMP] mail: add ping for active RTC session and clean obsolete
closes odoo/odoo#77382

X-original-commit: 263e77e5d252b61e1dd838c7559e957a20fa2b18
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-29 01:10:51 +00:00
Samuel Degueldre 9efd9463eb [IMP] mail: allow creating channels on first visit from token
This commit allows anyone to create a new mail.channel by visiting the
URL /chat/<token>[/<channel_name>], providing that the
mail.chat_from_token system parameter is set. This is useful in some
situations where new channels need to be created quickly as needed by
anyone without special permissions (eg, during the Odoo experience)

task-2648580

closes odoo/odoo#77010

X-original-commit: 56ddc073213a148579dd72f4a9336bc4d6a11f22
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Samuel Degueldre <sdegueldre@users.noreply.github.com>
2021-09-23 10:00:11 +00:00
Sébastien Theys 0a49d2cfa8 [IMP] mail: speed up time of RTC peers connection
Before this PR, the RPC to notify peers was called too much time too quickly.
Reducing request overload significantly improves the overall connection time.

closes odoo/odoo#76625

X-original-commit: f4c1d974b5d55868f81cd3259c45e83d934686f5
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-16 07:18:31 +00:00
Zelong Lin aa7bc757a2 [IMP] mail: allow user to edit message
task-2362167

closes odoo/odoo#76544

X-original-commit: 5d9d20748845652d2ecf527f4011522bf584807b
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-15 07:48:22 +00:00
Sébastien Theys 6d948bdb47 [IMP] mail: clean up code of RTC join/leave
Part of task-2366708

closes odoo/odoo#76528

X-original-commit: 9a05dfe06d9d5706d0e45ad14d6ef8902d6b276e
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-14 17:53:43 +00:00
Samuel Degueldre d9a6429e45 [FIX] mail: fix broken avatar on message from non-channel members
With the introduction of the guest feature, a lot of fields are now
accessed through a controller so that they can be available to guests,
with additional checking in the controllers.

Avatar is one such field, however the extra checks were too restrictive:
we only allowed people to see the avatar if the user whose avatar was
requested was also a member of the channel. This breaks the avatar on
previous messages if a user leaves a channel.

This commit relaxes this restriction for internal users (they can now
see all avatars through this route), and adds a fallback to the avatar
placeholder for people who do not have acces (ie: guests) so that the
UI doesn't look broken.

closes odoo/odoo#76341

X-original-commit: b849fd426806332c1ecc1bbba7b568384a021c65
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-14 06:01:12 +00:00
Julien Giannone 63ff23c218 [IMP] mail, web: add message reactions with emojis
task-2361194

closes odoo/odoo#75630

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-07 18:08:11 +00:00
Thanh Dodeur e38c91748d [IMP] bus, mail: add bus presence for guest
Part of task-2494829

closes odoo/odoo#76012

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-06 15:47:19 +00:00
Louis Wicket (wil) 401fc7efe9 [IMP] discuss: add 'Start a meeting' feature
- Add a new stand-alone page "WelcomeView"
    - Redirect people who join using an invitation link to the WelcomeView
    - Add microphone/camera preview
    - Allow guests to choose a name from the WelcomeView
- Add "Start a meeting" button to the discuss sidebar
    - Create a new channel on click on the "Start a meeting" button
    - Display ChannelInvitationForm on click on the "Start a meeting"
button
    - Add a new field to `mail.channel` in order to define the display
mode to use for videos (e.g full screen) when joining a meeting

Task 2494829

closes odoo/odoo#75899

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-06 08:21:38 +00:00
Thanh Dodeur ac99b09cdc [IMP] mail*: add audio and video conference with webRTC
*test_discuss_full,test_lint

This commit adds the audio and video conference feature to mail channels
and integrate it with the groupDM/guest features.

Adds new mp3 and ogg files (from task-2554674) for sound effects.

- Adds three new tables:
    * `mail.channel.rtc.session` to manage the peerToPeer interactions
      during rtc calls.
    * `mail.ice.server` to provide ICE servers necessary to establish
      peerToPeer connections with webRtc.
    * `res.users.settings.volumes` to hold the partner-to-partner volume
      settings, each partner can create one new setting per other
      partner to configure the volume coming from those partners during
      calls.

- changes res.config.settings:
    * Adds new fields for the Twilio credentials to use their STUN/TURN
      service.

- changes res.user.settings:
    * Adds 4 fields for the push to talk and voice activation.

- changes mail.channel:
    * Adds a new field `rtc_session_ids` that represents the active
      participants in a rtc call on that channel.

- changes mail.channel.partner:
    * Adds a new field `rtc_inviting_session_id` that represents the
      rtcSession of the user that is inviting that channelPartner to a
      call.

task-2366708

closes odoo/odoo#66611

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-04 06:23:56 +00:00
Sébastien Theys 3ef53c8e5a [IMP] mail: make guest cookie smaller and add expiration date
Part of task-2494829

closes odoo/odoo#75888

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-03 02:03:58 +00:00
Samuel Degueldre 776d1ee08b [IMP] mail: allow user to delete their messages
This commit allows users to "delete" their messages in discuss, as well
as their notes on other records. Admins can delete anyone discuss
messages or notes. Tracking messages such as a change in stage or other
cannot be deleted.

This "delete" is a "soft-delete" in that it only empties the message's
content, so that it is no longer displayed in the UI, but remains in the
database so that people who got notified by email can still reply to the
message, among other things.

task-2365646

closes odoo/odoo#74857

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-03 02:03:25 +00:00
Louis Wicket (wil) 80d74e7ee0 [IMP] mail, web, *: add support for guest users
* = crm_livechat, hr, hr_holidays, im_livechat, mail_bot, purchase, sms,
    snailmail, survey, test_discuss_full, test_mail, web_editor, website,
    website_livechat

 - Create new model `mail.guest` for guests.
 - Rewrite some RPCs to target routes rather than model methods so that
   guests are able to use them.
 - Patch JS and python models to support guests.
 - Create a stand-alone page and boot the channel in it.

task-2494829

closes odoo/odoo#75496

Related: odoo/enterprise#20417
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-09-02 00:43:34 +00:00
William Braeckman 5b05352c99 [IMP] mail: add optional mail subtypes
This commit adds a way to filter out mail message subtypes for specific
records.

Task ID: 2585025

closes odoo/odoo#74764

Related: odoo/upgrade#2719
Related: odoo/enterprise#20096
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2021-08-30 13:27:50 +00:00
Thibault Delavallée cc109457cc [REM] mail: remove dead controllers
Some controllers are not called anymore. Let us remove them to remove
unnecessary entry points.

Task-2631873
PR odoo/odoo#75571
2021-08-25 13:12:11 +00:00
Thibault Delavallée 1b4e0099d4 [MOV][FIX] mail: quickly reorder code parts, remove dead imports, fix code bits
Reorganize code to ease future additions understanding and setting code
at the right place.

Rename some compute methods to have understandable names.

Remove dead imports.

Fix pytz.utc usage.

No functional change comes with this commit. This is only code move.

Task-2631873
PR odoo/odoo#75571
2021-08-25 13:12:11 +00:00
Thibault Delavallée cb67c23888 [MOV] mail: reorder controllers and views
As mail grows and will continue to grow, ordering views and having right
files is important to understand module organization and content.

Split main.py controller file into two files, one for mail related controllers
(redirections) and one for discuss.

Rename files according to guidelines for wizards and views.

No functional change comes with this commit. This is only code move.

Task-2631873
PR odoo/odoo#75571
2021-08-25 13:12:11 +00:00
Sébastien Theys 96d7102ee2 [IMP] mail, *: move init messaging in models and avoid self.env.user
* = im_livechat, test_mail

The goal of moving it in models and making it independent of current user is to
be able to test it easily in future commits.

Part of task-2622462
2021-08-12 10:11:42 +00:00
Sébastien Theys 7582625ba7 [IMP] mail, *: remove magic from channel commands
* = crm_livechat, im_livechat, mail_bot, test_mail_full

Those are hard-coded methods just like any other, remove the magic call and the
need to forward them to the client at init.

Part of task-2622462
2021-08-11 18:02:37 +00:00
Martin Trigaux c7bac3dee0 [IMP] *: make ir.model.data helper private
No reason to interfact with them directly in RPC
2021-08-10 13:49:04 +02:00
Sébastien Theys c96a30a8fb [IMP] mail: remove static mention suggestions
Returning all the users at init does not scale. Mention suggestion code is good
enough now that this is no longer necessary.

closes odoo/odoo#73689

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-07-14 10:45:44 +00:00
std-odoo 59d6bb23d7 [REM] mail: remove mail channel moderation
Rationale
=========

Currently, mail channels have 2 modes
- They can be used like Discuss channel (chat, livechat, group)
- They can be used like a Mailing List (with the "email_send" field)

The mix of both feature in the same model causes some code complexity.
Several fields are not used in both cases (moderation related field)
and the future "Discord like" Discuss will even push the mail channel
further than the usage of the mailing list.

Because of all those reasons, we want to split the 2 mains features of
the mail channels into 2 different modules and models.

Purpose
=======

This commit remove the moderation feature of the mail channel
(email_send=True). This will be re-implemented in a separate module
in the next commit.

Do not be able to check messages in Discuss anymore because this
feature is only used to moderate the message and this feature will be
spitted in a new module "mail_group".

Links
=====

Task-2510267
See odoo/odoo/pull/71599
See odoo/enterprise/pull/19296
See odoo/upgrade/pull/2600
2021-07-09 11:16:38 +00:00
Jeremy Kersten 478068c829 [IMP] *: always use Odoo Response
This branch adds request.redirect on all requests.
In case of a front end request, we do an url_for to the location.

We removed redirect_with_hash that was only for retro compatibility

local_redirect has been renamed to redirect_query, and param keep_hash has been
removed and moved.

Default code for redirect is 303 now instead of 302.

Now redirect and redirect_query make local redirect by default, you need to
pass local=False to make external redirect.

All werkeug.utils.redirect has been replaced by request.redirect.

Http.redirect now use an http.Response type, and it become easy to add an
override like 'set_cookies' e.g.

Dispatch of a website.page return an http.response too, so we first need to
check if it is a cached version before to check if it is an Odoo Response.

Migrate your code:

http.redirect -> request.redirect(location, code, local)
http.local_redirect -> request.redirect_query(location, query, code, local)
http.redirect_with_hash -> request.redirect

Courtesy of odony for help and review ;)

closes odoo/odoo#72599

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-07-08 07:00:06 +00:00
Leonardo Pavan Rocha c53724ebc3 [IMP] *: adds generic user avatar
Description of the issue/feature this PR addresses:
It is currently quite difficult to differentiate users. Most of the time, people
don't take the time to upload an actual avatar so everybody looks the same. This
PR generates a custom avatar with the users initials and random color to
differentiate them. For res.users, res.partner and hr.employee, image fields now
hold the binary image and avatar are used to show the image or svg.

Current behavior before PR:
Avatar had only random colors and was being saved in database, being inefficient

Desired behavior after PR is merged:
A new mixin defines image fields and in case no image is set, it generates an
SVG image with the user's initials and random color.

closes odoo/odoo#69819

Task: 2404630
Related: odoo/enterprise#18199
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-06-01 14:36:23 +00:00
nounoubensebia fa0738dd7e [FIX] mail: display default name for followers for "other address" partner
Display the default name (the one displayed in the kanban view) for followers replacing
the False value for "other address" partners, this way the user won't get
confused, furthermore, this fix won't require the name to be mandatory for this
type of contacts.

Task-2514244

closes odoo/odoo#70445

X-original-commit: 338b84bd9d2d675af30ab19c6bb262d2f68546b9
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-06 08:00:36 +00:00
Thibault Delavallée 4cb1f56aba [REF] mail, sms, test_mail: remove now unused channel_id field on Py and JS follower models
RATIONALE

Channel model is a mail.thread enabled model behaving strangely with followers,
notifications and discuss. Its code should however be simplified to be more
self contained and avoid unwanted side effects on other models.

PURPOSE

Remove channel ability to follow records as it mainly adds noise without a lot
of added value. Simplify channel notification flow by using directly members
and not a delegation through a channel self-following trick. Remove followers
being channels and posting with added listeners being channels.

SPECIFICATIONS

As there is no way to add channel-based follower anymore we can remove all
fields and code supporting this feature. Notably we can remove ``channel_id``
field on ``mail.follower`` model as well all code using it, notably compute
methods.

In this commit we also make ``partner_id`` field required as now followers
are always partners. Email, name and active fields are now simple related
fields on the partner.

Code computing data about subscription is also updated and simplified. As
we do not have channels anymore but only partners all custom SQL queries
are now simplified.

JS models for Discuss are also cleaned. Following python change, JS models
are simplified to match the backend models. Channel_id is removed, partner_id
is now required, and various code is updated according to the simplified
model.

Side note: we could probably get rid of specific index on ``partner_id``
field. However we have to ensure we never search for followers without being
in a model / res_id context. This will be done in another cleaning step to
be sure performance are not broken.

LINKS

Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
2021-03-17 18:16:18 +00:00
Thibault Delavallée d2079b1fca [DOC] mail: clean some docstrings and helpers
As I was passing by I found some docstrings or helpers could be updated or
rephrased a bit more clearly. This is free as in free beers, without beers.

Some code about mail features (posting) may also be re-indented to ease
understanding of future modifications. Or just because we had to read
it and go through many files. Still free beers.

LINKS

Task ID-2477444
Prepares Task ID-2377974 (trace management cleaning task)
Prepares Task ID-2070632 (channel members main task)
Prepares Task ID-2419762 (channel members followup task)
COM PR odoo/odoo#67382
UPG PR odoo/upgrade#2245
2021-03-05 15:20:53 +00:00
Sébastien Theys fe93fc28eb [FIX] mail, im_livechat: properly handle multiple public partners
task-2391334

closes odoo/odoo#63002

X-original-commit: 9fbea9f8ee193e672c855c73ad29de187f27cef1
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-12-08 11:28:38 +00:00
Priyanka Kakadiya 2b06be6860 [IMP] mail: improve followers refreshed on thread
PURPOSE

Currently it does two RPCs to refresh followers on thread:
1) To get follower ids
2) To get followers detail

SPECIFICATION

While refreshing followers on the thread, perform only one RPC call.

LINKS

Task-2243180
PR https://github.com/odoo/odoo/pull/54437

closes odoo/odoo#55989

X-original-commit: 1fd445fb55810b97ed7a6dfe694e471891c6a3bc
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-08-17 11:56:46 +00:00
Sébastien Theys c2918c139b [IMP] web, *: improve mock server and replace most mail mockRPC
Improve mock server:

- add support for mocked `fetch`
- add support for `active_test`
- add support for x2m `in` in domains
- add support for default values computed from a function
- implement a more natural "next id" compute
- allow initial data without ids
- ensure write and x2m commands integrity
- improve bad data/bad commands error messages
- always warn for failing RPC, not only in debug mode
- fix all existing tests that had inconsistency data

Other changes done in mail (or dependents) that are not just related to tests:

- remove `direct_partner` from formatter result
  ->`correspondent` can be computed from other keys, especially `members`

- fix `livechat_visitor` convertData
  -> only process if there is value

- add `current_partner` and `current_user_id` as `init_messaging` result
  -> easier to mock than session

- remove usage of `need_moderation`
  -> that was just a search indirection to `moderation_status`

- adapt `partner_id` -> `res_partner_id` key in `_notification_format`
  -> to be consistent with field name

- add name in result of `mail_partner_format`
  -> sometimes display_name is not the same

- remove usage of `is_moderator`
  -> that was just an indirection to `moderation_channel_ids`

Enterprise counterpart: https://github.com/odoo/enterprise/pull/11523
task-2287171

closes odoo/odoo#55854

X-original-commit: 7ba3fecb3377a720d1eb70e7515a0c45da73836d
Related: odoo/enterprise#12391
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-08-13 16:26:35 +00:00
Victor Feyens ad6b5e35f2 [IMP] *: do not translate logs
The logs should all be in the same language, s.t. one does not need to 
understand multiple languages when browsing/reading the server logs.

closes odoo/odoo#53984

Related: odoo/enterprise#11615
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-07-02 15:12:56 +00:00
Xavier Morel 5a6d4c4932 [FIX] mail: when warning about password user, fetch partner as su
The superuser is already used to check whether modules are installed
with demo data and create the notification.

It was not used for accessing the admin partner though, so in the case
where a user is logging in with the password "admin" and with no
access to `partner_admin` it's going to blow up the login process
despite no reason to.

Admittedly this is somewhat difficult to achieve in "standard" odoo,
it was only discovered because 2FA (odoo/odoo#33928) can reach this
point without having a "proper" session set up as that set up is
delayed until after the MFA step has succeeded while
`_admin_password_warn` is part of the redirection flow from the
initial login (user/password input).

closes odoo/odoo#53244

X-original-commit: d18d226084a8b47f2858d8a271886115b29d7b2f
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-06-18 12:17:15 +00:00
Martin Trigaux ba244cef01 [IMP] *: replace to new _() syntax
Using a few regex like
\((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\)
($1, $3))

Old syntax is still compatible but starts the migration to the new
syntax that catches error.
2020-06-18 13:03:34 +02:00
3fea5b2136 [REF] mail, *: refactor messaging with OWL
This commit is a significant rewriting of client-side discuss, chatter,
chat window, and messaging menu using OWL. The behavior should be broadly
the same, with some slight functional changes here and there.

From a technical standpoint, the code of messaging is mainly organized in 2
main groups of modules:

- models, which are logical entities that depict the client-side state of
  messaging as a whole.
- components, which are in charge of displaying information from models.

This refactoring also introduces new JS guidelines regarding folder structure
(/static) and naming rules for JS modules.

Community PR: https://github.com/odoo/odoo/pull/39023
Enterprise PR: https://github.com/odoo/enterprise/pull/6249

Task-1914207

This PR is a collaborative work by Alexandre, Julien, Sébastien and Xavier,
with the precious help of Lucas to speed it up towards the end.

closes odoo/odoo#39023

Related: odoo/enterprise#6249
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Alexandre Kühn <aku@odoo.com>
Co-authored-by: Julien Giannone <jgi@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
Co-authored-by: Xavier Dubuc <xdu@odoo.com>
2020-06-15 18:12:21 +00:00
Martin Trigaux 1f410436d6 [FIX] mail: remove unused route
The route is no longer used but was still present in the code.
Processing email should be the job of the fetchmail server and they
should not be injected directly from outside (even if emails are
unauthenticated by design, mail servers may still have some say in the
process).

Courtesy of Alexandre Díaz

closes odoo/odoo#50084

X-original-commit: ab70afb3963b0952e938ab39ef3dcb47ecc01f61
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-04-23 14:54:24 +00:00
Olivier Dony d05c813653 [FIX] mail: mute default password warning on demo databases
The point is to warn admins of production and public-facing databases.
However it is not necessary to nag users of demo databases, even when
connecting non-locally (e.g. on runbot).

Updates #37580

(manual) forward-port of #48689

closes odoo/odoo#48691

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2020-04-01 00:07:31 +00:00
Xavier Morel de590816d8 [FIX] *: deprecated access to url_ utilities through werkzeug root
In 0.15 accessing werkzeug.urls functions directly through werkzeug
is deprecated, the shortcut will be removed in the eventual werkzeug
1.0.

Fix existing uses of these shortcuts. Also cleanup some imports when
they're not far from a werkzeug* import being altered.
2020-02-04 12:42:35 +00:00
Nicolas Martinelli e269715d81 [FIX] mail: message for AccessError
`AccessError` requires the argument `msg`. Therefore, even if this error
is catched, we need to provide one, otherwise a `TypeError` is raised.

opw-2183184

closes odoo/odoo#44452

X-original-commit: cdefbf8d66e42d88d845dd621e0306cb55c5f79a
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-02-03 09:18:32 +00:00
15c934a1ab [IMP] (website_)mail: improve routes and management of mail followers
Purpose of this commit is to improve model of followers, notably management
code and its use in routes. Indeed it is quite an old model and code had
to be cleaned a bit to improve code readability and maintenance.

In this commit we

  * remove unnecessary code examples in gamification about followers: using
    that model as example of code for goals is probably not a good idea as it
    is technical;
  * rewrite routes called by JS are simplified to better match JS
    implementation;
  * introduce computed fields to fetch related partner or channel name,
    email (partner only) and active status;

LINKS

Task 1933771
Task 2078313

closes odoo/odoo#39808

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Remy Voet <ryv@odoo.com>
Co-authored-by: jgi-odoo <jgi@odoo.com>
Co-authored-by: Xavier-Do <xdo@odoo.com>
2020-01-21 16:40:06 +00:00
Jorge Pinna Puissant d821999025 [FIX] mail: restore "pencil" icon behaviour in Followers widget
When editing the followers, the "pencil" icon that leads to the edition
of subtypes should be always be displayed, and not only when "debug"
mode is activated. This commit restores this behaviour, as it was not
the case any more.

opw-2144399

closes odoo/odoo#41643

X-original-commit: fd65f85e755eb0b732e0876c1849a0f4806968f1
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2019-12-09 13:57:47 +00:00