Commit Graph
15 Commits
Author SHA1 Message Date
Sébastien Theys 07048871af [FIX] mail, im_livechat, *: restore usage of livechat user name
* = website_livechat

Prevents from leaking unnecessary information to livechat clients.

opw-2453956

closes odoo/odoo#82026

X-original-commit: 5ec191d288d5b44f78cd1f6980c47bb64cfd9bd1
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-12-29 16:55:47 +00:00
Sébastien Theys 9772512e7a [IMP] mail, *: batch channels at init messaging
* = im_livechat, test_discuss_full

Less code, less queries.

Part of task-2622462
2021-08-12 15:22:37 +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
Samuel Degueldre 2d3dbe9217 [IMP] tests: allow browser_js ready code to be a promise and await it
closes odoo/odoo#74789

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-08-06 12:33:54 +00:00
Samuel Degueldre 37aca4a38e [FIX] im_livechat: add missing dependencies to manifest
The dependencies of the public_root module were recently updated, but
the manifest of im_livechat was not, causing it to fail to load. This
commit adds those missing dependencies to the manifest.

This commit also adds a test that checks that all modules are properly
loaded on the support page, since this has been broken on multiple
occasions while changing the dependencies or the path of some of the
modules this page needs to work.

closes odoo/odoo#74756

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-08-06 10:15:23 +00:00
Sébastien Theys 93c4b03737 [FIX] im_livechat: show chat to operator only after first message
Not sure exactly because of which change, but channel partner is now created
with its default is_pinned value (True) taken into account, which was not the
case before. This is a good change in general, but the livechat code relied on
the old behavior.

This commit makes it explicit that in this case the value should be False, and a
test is added to guarantee it once and for all.

This commit also fixes an issue during init messaging, where ids of res.partner
were searched instead of ids of channel.partner.

task-2547806

closes odoo/odoo#71647

X-original-commit: 2088883c4f6dda9dd3ccddc14a7b9da68ee873cd
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-06-03 07:45:30 +00:00
Thibault Delavallée e5338146e7 [REF] mail: make message belongs to a single thread without listener channels
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

In this commit we force messages to belong to a single document using
``model`` / ``res_id`` pair. It is not possible anymore to link a message
to channels using ``channel_ids``. A message belongs to a document and
is displayed in that document's chatter.

This change implies modifying a lot of domains, notably in chatter. Indeed
discuss for channels does not use ``('channel_ids', 'in', [3])`` domains.
They now use ``('model', '=', 'mail.channel'), ('res_id', 'in', [3])`` like
other documents fetching their messages.

This commit also removes ``channel_message_ids`` field on ``mail.channel``
model. As channels are now considered as standard documents they will use
``message_ids`` field like all other documents. Linking a channel on a message
is possible only as a link in message from now on. It is not possible to push
it into a channel anymore (no more listener channels, no more channel link).

Finally a global cleaning also linked to all previous commits is done.

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:35 +00:00
Sébastien Theys efb66e8e7f [FIX] mail, im_livechat: make livechat work properly
- fix traceback on receiving first livechat message due to bad computation of
  correspondent
- fix missing [0] in return of country name_get in channel_info
- fix visitor/correspondent computation to work when chatting with oneself
- reintroduce livechat ordered by last message in discuss sidebar
- improve mock server to make these fixes possible to test
- introduce corresponding tests

PR: #56243
task-2323670

closes odoo/odoo#56423

X-original-commit: f623bfd2c8819604c709bc723153c071dca6e3cc
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2020-08-24 13:47:01 +00: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
David Beguin 33f5bbc7d0 [FIX] website_livechat, im_livechat : use visitor display name instead of name
As since 5b9a81a2c6
website.visitor.name can be null
if the visitor is not linked to a lead or a res.partner,
we cannot use the name anymore to build the name of the mail.channel, etc..
Using display_name will always return the correct value,
and will include the numbering of the visitor,
in order to identify easily the chat windows
(if operator is speaking with multi visitor at the same time)

Task ID: 2076190
PR #37340
2019-09-24 13:25:50 +00:00
Raphael Collet 9920f20e4c [IMP] models: ORM speedup
This branch is the combination of several optimizations in the ORM:

* store field values once in the cache: the cache reflects more
faithfully the database, only fields that explicitly depend on the
context have an extra indirection in the cache;

* delay recomputations by default: use method `recompute` to explicitly
flush out pending recomputations;

* delay updates in method `write`: updates are stored in a data
structure that can be flushed efficiently to the database with method
`flush` (which also flush out recomputations);

* make method `modified` take advantage of inverse fields to inverse
dependencies;

* filter records by evaluating a domain on records in Python;

* a computed field with `readonly=False` behaves like a normal field
with an onchange method;

* computed fields are computed in superuser mode by default.

Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien
Pinckaers.

closes odoo/odoo#35659

Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-08-20 12:43:59 +00:00
David Beguin 78e6ce3c3f [IMP] website_livechat : allow to send chat request to a website_visitor
This commit allows a livechat operator to send a chat request to a
connected and available website_visitor.

A visitor is considered as connected if his last tracked website.page request
was within the last 5 minutes.
A visitor is available if he doesn't have an active livechat conversation
(mail_channel with type = livechat).
  - If another operator sent him a chat request
  - Or if the visitor asked himself to speak with an operator
    (via the normal and existing flow)

A livechat conversation is active while the visitor haven't left the conversation.
An operator cannot leave a livechat conversation, only the visitor can.

The flow to send a chat request:
  - On the visitor view (tree or form), operator click on 'send chat request'
    (button or livechat icon)
  - A empty conversation with the visitor pops up at operator side.
  - While the operator didn't send a message, the visitor won't see the conversation.
  - The operator can type a message to the user
  - If the operator close the chat without sending any messages,
    the chat request AND the mail_channel are both deleted.
    In this case, the visitor is then available to send him a new chat request.
  - If the operator send a message, at the visitor's next action
    (page navigation on pages that allows livechat, based on livechat rules),
    the conversation will pop up at visitor side, using the livechat button widget.
    The visitor won't be able to request a livechat conversation with an operator until
    he leaves the chat requested by the operator.
  - Once the visitor leaves (with or without rating) the conversation :
        - the operator is notified that the visitor has left the conversation
        - the chat request is deleted to keep the chat request table clean and minimal
        - the livechat conversation if set to inactive.
  - The visitor is now available again to send him a chat request.

This feature uses the already existing livechat_session cookie mechanism,
so no further code modification was needed to make this work.
It's directly integrated is existing livechat flow.

The chat_request model is only useful to quickly check if a visitor has a chat request
and to send the livechat conversation info to the visitor via the livechat_session cookie.

This commit also add a website_visitor banner info on discuss view :

To be able to quickly see all the relevant information of a website visitor
while talking with in discuss view, a fixed banner have been added.
Only the discuss view will benefit from this because detached chatter window
is to small to display such banner.

Task ID: 34624
PR #2028059
2019-08-19 06:33:37 +00:00
Kaushalya Mandaliya 8922ab710d [IMP] im_livechat: display country with a known partner name
When talking via the Live Chat to a known partner,
should be able to see his country with his name to avoid checking
the partner view form to get that information.

And improving a test case, in which we're checking for the known partner's
country name along with his name in the chat window title.

task-1940407
closes #31346

Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
2019-06-10 04:43:32 +00:00
Kaushalya Mandaliya 7a3a1a43b3 [FIX] im_livechat: correctly display known partner name
When talking via the Live Chat to a known partner, should be able to see
his name in the chat window title, from the commit: c04b9c019e
the partner name wasn't showing in the title as sudo is being used.

After this commit, known partner name will be shown in the
Live Chat window title.

And improving a test case, in which we're checking for the known partner's
name in the chat window title.

task-1940407

closes odoo/odoo#33831

Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
2019-06-06 04:45:21 +00:00
Aurélien Warnon 9b867cd12d [IMP] im_livechat: improve random assignation of conversations
Task #1919871

Purpose
=======
The method 'get_mail_channel' in the 'im_livechat.channel' model used a simple random.choice in
the available users to select the operator.

It was improved to select the operator that has the lowest number of active livechats. If multiple
operators share the same number (lowest) of active livechats, it selects randomly between those.

A livechat is considered 'active' if it has at least one message within the last hour.

Spec
=======
The assignation method should always give the new conversation to the operator who
has the less active conversation.

If two operators have the same amout of active conversation, it should chose one of
them randomly.
2019-04-01 07:03:11 +00:00