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
closesodoo/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>
Before this commit, chatter without messages did not display
attachment counter, even though attachments could be uploaded from
attachment box.
This commit now displays the attachment counter in this case.
Task-Id 2149348
closesodoo/odoo#42672
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Before this commit, the test 'all messages in "Inbox" in "History"
after marked all as read' had non-deterministic failures.
More precisely, it crashed on either assertion "there should be 30
messages in History" or "there should be 40 messages in History",
both resulting to 0 messages in History instead.
Unfortunately, as of the date of this commit, we still do not
understand why it rarely fails. In the meantime, we have decided to
make these errors less likely to happen, by waiting much longer
before the assertions. We are aware that this is a poor solution,
but this is much better than skipping the test, until we find and fix
this issue at a later moment.
Closes#43072
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
The test may fail non-deterministically from intercepting an
heartbeat in the local storage. Only a document thread window fold
state change from the local storage should be intercepted.
Closes#43072
Issue
- Install CRM for example
- Add 41 leads
- Create an activity on each of them
Everything ok, load more shows up
- Add another activity on one of them
Load more doesn't shows up
Cause
The uniquify method:
https://github.com/odoo/odoo/blob/saas-12.3/odoo/models.py#L4187:#L4191
Consider the second activity as a duplicate and removes it.
So, in `web_search_read`:
`len(records) <= limit` is `True` and we ignore all
the others records
Solution
Add `force_search_count` in the context when using this action
to avoid uniquify to falsify the records length.
I added the tree view for this action too. It improves UX.
OPW-2165455
closesodoo/odoo#43149
X-original-commit: 13ec3503fbfb5d3d2b1e824059737bd866a3a9f4
Signed-off-by: Jason Van Malder <jvm-odoo@users.noreply.github.com>
Before this commit, opening the messaging menu might be slow.
This was caused by the parsing of bodies of messages with lots of
HTML nodes. Indeed, the body of a message is linkified and inlined,
and both processes were quite slow due to their implementation: each
node in the HTML were recursively parsed and re-assigning
`innerHTML`. As a result, each node was triggering an HTML parse,
which is very slow on complex nodes.
This commit fixes this performance issue by speeding up inlining and
linkifying of html strings. In the case of linkify, it now triggers
an HTML parse only when necessary, while inlining now relies on its
textContent value.
These changes should drastically improve the speed of opening and
rendering messaging menu, almost ten times faster.
Task-Id 2076299
closesodoo/odoo#42949
X-original-commit: 8db0afb50ce0853a6a8ab7ee11dd5ed876abab64
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Before this commit, when "Send message" composer was open with some
suggested recipients, and then editing and saving data related to
the suggested recipients, the suggested recipients were not updated
on composer until some user interactions like page reload.
Steps to reproduce:
- Open an opportunity in CRM;
- Open "Send message" composer;
- Change "Email" field;
- Save changes;
> Suggested recipient above composer textarea is not updated with
newly saved email adress.
It becomes updated only after some user interactions, such as toggle
"Log note" then "Send message" or with a page reload.
This commit fixes the issue by updating the suggested recipients on
the composer in real-time when clicking on "Save".
Task-Id 2089816
closesodoo/odoo#40033
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Co-authored-by: Alexandre Kühn <aku@odoo.com>
Timer test relies on setTimeout(..., 0) for its execution and its
verification. However it seems that in the browser there is *not always*
a guarantee that 2 setTimeout(...,0) will execute in a specific order.
Delaying the verification by 1 ms : setTimeout(..., 1) should force the
order of execution.
closesodoo/odoo#41732
Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
This reverts commit e5479fcfdb.
This commit prevented an issue of losing messages on post in case
of connectivity loss. The implementation consists of keeping the
content in the composer until the server acknowledges handling the
message.
However, this solution introduces significant issues. For instance,
sending messages in quick succession will likely loose or duplicate
some content, based on how fast/slow the RPC `message_post` is
resolved. Plus, there was an issue on mobile because the input focus
was lost during the RPC. As a consequence, the virtual keyboard
flickered.
The intent was to fix a rare issue, and since the problems of this
solution clearly outweigh the gain, we decided to revert.
closesodoo/odoo#41544
X-original-commit: 36b2e99e08bfc6d92a821d0346e783695580abf9
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Before this commit, when navigating from test environment (e.g.
page reload), it crashed with following error:
`TypeError: Cannot convert undefined or null to object`
This error comes from mocked bus services in tests: even when they
have been destroyed, they handle the window event 'unload'. They
no longer have a parented parent, so `this.call()` returns
`undefined`, hence the crash.
This commit prevents mocked bus services to listen on window 'unload'
event. Tests must always simulate this window event by explicitly
calling the handler.
closesodoo/odoo#41378
X-original-commit: fd08d04f0a24fea52e7b668b90aec48b33d349a3
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
PURPOSE
Clean posting process and improve mail.message definition and comprehension.
SPECIFICATIONS
In order to be more explicit subtype parameter is renamed to subtype_xmlid.
It therefore clearly indicates it should be a valid subtype Xml ID. Support
of ill formatted Xml IDs is removed because there is no reason to try to
add some random prefix. Give something that exists or go to hell, punk !
LINKS
Task ID 2071556
PR #38692
This commit adds the out-of-office ribbon at the top of the
conversation in the discuss app.
Task-2066672
closesodoo/odoo#39362
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
In discuss, make a search with some stuff, and try to save
that filter as favorite
Before this commit, there was a crash, because the Discuss action
did not implement what the controllers do to save favorites.
After this commit, it is possible to save a filter as favorite
OPW 2087258
closesodoo/odoo#39519
X-original-commit: 5514a414324675bf5c2cc0360e429a7d2548b16f
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Revision on https://github.com/odoo/odoo/commit/9a66619db33fca5f0cb81d9f6bfeb0fb0290cf68
Commit above improves the web client startup by not having to wait
for discuss widgets to fully load beforehand.
However, it introduced an issue with chatter when the 1st rendering
happens before messaging becomes ready: it displays
"Creating a record..." instead of the whole history of messages.
This happens because when messaging is ready, it updates data from
the chatter but it does not trigger a re-render.
This commit fixes the issue by triggering a re-render on messaging
ready. When messaging is not ready, thread field now displays
"Loading..." instead of the message "Creating a record...".
Task-Id 2078193
closesodoo/odoo#38751
X-original-commit: 93bdd7c91095025f4d6e7a058e0ab1c4e1a0ad60
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Revision on https://github.com/odoo/odoo/commit/e7aff236b8073b952a0e554d9897a8f88d5c4c91
Commit above remove cross icon on attachments from messages that are
not in the chatter, since this only makes sense in the chatter.
However, it also removed by mistake the possibility to delete
attachments from the attachment box in the chatter.
This happens because the template of attachments uses a newly
introduced contextual boolean `isDeletable`, and this is false by
default due to undefined being falsy.
This commit fixes the issue by explicitly enabling deletion of
attachments from the attachment box.
Task-Id 2081987
closes#38003
X-original-commit: 1a175686d493d9f289cf391b65a56adc80da82c2
Go to hr.applicant view form, Edit and change something.
Each time you change a field, the Attachment box in the chatter is toggled
(as if you were clicking on the small attachment button each time).
This a wrong behavior of the `open_attachments` option of the `mail_thread`
widget.
Opening the attachment box should be done at the widget initialisation,
not at every render.
closesodoo/odoo#38720
X-original-commit: 400a1f7bc3d00f5bc95bdbfe1dfadf9d251d808b
Signed-off-by: lul-odoo <LucasLefevre@users.noreply.github.com>
Before this commit, the url for the src of the iFrame used
to display text files in the document viewer wasn't properly set,
resulting in the `model` argument to be invalid.
This commit fixes this issue.
Task-Id 2058588
closesodoo/odoo#36160
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Before this commit, discuss widgets had to wait for the route
`mail/init_messaging`. This behaviour slowed down the loading of the
web client.
This commit solves the issue by rendering discuss widgets even when
`mail/init_messaging` hasn't been resolved. For instance, the
messaging menu displays a spinner until messaging becomes ready.
Task-Id 2072835
closesodoo/odoo#37031
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
When a user either joins and leaves a channel, it posts a message of
type 'notification' with either action as content.
Before this commit, such messages above were incrementing the unread
counter of the channel. As a result, the messaging menu was showing
this channel as unread with this message.
Messages of type 'notification' should never increment the unread
counter of channel.
This commit fixes the issue by preventing new messages of type
'notification' to increment the unread counter of a conversation.
This should also prevent increasing the counter of the messaging
menu, in addition to highlighting this channel as unread from the
messaging menu.
Task-Id 2059515
closesodoo/odoo#36293
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Before this commit, a channel in mobile with option "Send messages
by email" had no composer when opening in mobile.
This issue happened because channel views in mobile are in fact chat
windows. Chat windows with such channels do no display any composer,
which is intended in desktop.
This commit fixes the issue by enabling the extended composer for
chat windows with email channels, just for mobile.
opw-2059468
closesodoo/odoo#36120
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Before this commit, there could be an infinite loop when changing
the chat window state of a document chat window.
This is caused when mutiple tabs overwrite the chat window state
with a different value everytime, resulting to an infinite loop.
Accross multiple tabs, `setItem` and `onStorage` are not synchronous.
That's why tabs should communicate through local storage events
instead of actual value in the local storage.
To illustrate the issue, suppose there are 2 tabs (T1 and T2) with
one document chat windows (C) and the following user interactions:
- T1 and T2 both have C open
- on T1, user folds C
- on T2, user folds C
Now let's add an example of local storage (LS) logics that could
apply from above example:
- T1 and T2 both have C open
- on T1, user folds C
[1] T1 writes 'C folded' in LS
- on T2, user folds C
[2] T2 writes 'C folded' in LS
[3] T2 detects 'C folded' in LS (from [1])
=> T2 writes 'C folded' in LS
[4] T1 detects 'C folded' in LS (from [2])
=> T1 writes 'C folded' in LS
[5] T1 detects 'C folded' in LS (from [3])
=> T1 writes 'C folded' in LS
[6] T2 detects 'C folded' in LS (from [4])
=> T2 writes 'C folded' in LS
etc...
This scenario could have been easily prevented by not writing on
local storage when the chat window state has not changed. However,
this wouldn't fix this scenario that also introduces an infinite
loop:
- T1 and T2 both have C open
- on T1, user folds C
[1] T1 writes 'C folded' in LS
- on T2, user folds C
[2] T2 writes 'C folded' in LS
- on T2, user unfolds C
[3] T2 writes 'C unfolded' in LS
[4] T2 detects 'C folded' in LS (from [1])
=> T2 writes 'C folded' in LS
[5] T1 detects 'C unfolded' in LS (from [3])
=> T1 writes 'C unfolded' in LS
[6] T2 detects 'C unfolded' in LS (from [5])
=> T2 writes 'C unfolded' in LS
[7] T1 detects 'C folded' in LS (from [4])
=> T1 writes 'C folded' in LS
[8] T2 detects 'C folded' in LS (from [7])
=> T2 writes 'C folded' in LS
[9] T1 detects 'C unfolded' in LS (from [6])
=> T1 writes 'C folded' in LS
etc...
This commit fixes the infinite loop issue:
- by turning local storage read during cross-tab communication into
local storage event read instead. This should prevent race
conditions based on read/write operations in local, since their
order is not guaranteed accros tabs.
- by isolating document chat window state to their own local
storage entry. This should prevent a tab from notifying a chat
window state that it didn't change, which may also result in
an infinite loop.
Some tests were adapted from the changes above. Also, some tests did
pass thanks to local storage being mocked by a ram storage: the
handler `_onStorage` should have been called, but it didn't because
it was registered on the actual local storage instead of the ram
storage. In order to make tests pass again, the following additional
changes were required:
- Cross-tab bus service now exports the unique tab ID with
`getTabId`.
- document thread entries in local storage now track the tab ID, so
that self-tab ignore their own local storage writes.
Task-Id 2034997
Closes#36177
Before this commit, when a user received a needaction notification
on a message already stored locally, it crashed with this error:
`TypeError: Cannot read property 'getThreadIDs' of undefined`
This is caused by `addMessage` returning a Promise not resolved with
the message when the message is not new. The returned promise should
always be resolved with the message, in order to be consistent.
closesodoo/odoo#35724
Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
Revision on https://github.com/odoo/odoo/commit/e8f7770a13d6ddc1cb8ec1bcebcb22e21962ba52
Commit above fixes an issue with chat windows being open twice.
It fixed the issue by aborting opening a chat window in case a
chat window is already being open.
Opening chat window may be a slow process, due to requiring fetching
some messages beforehand. This operation is necessary in order to
check whether the user has access to messages or not, and prompt an
error message without opening the chat window in the latter case.
The fix did not respect the specs of the method `openThread`: it
pre-emptively returned nothing, instead of returning a resolved
promise. Because of this, it crashed on `undefined.then()`.
Task-ID 2053095
closesodoo/odoo#35722
Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
Before this commit, The dropdown menu remained open after clicking on
activity icon.
After this commit, The dropdown menu is closed whenever the activity
icon is clicked.
Task-Id: 2047408
closes: #35568
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Before this commit, we may have the following error:
`TypeError: Cannot read property 'html' of undefined`
This happened in the following scenario:
Terminology:
- in multi-tab environment, there is a master tab and slave tabs
- master tab fetches notifications from the server and forwards them
to slave tabs
State:
- 2 logged-in users: Michell & Marc
- Mitchell has open 2 browser tabs
- Mitchell has a pinned private conversation with Marc
Steps:
- Mitchell has focus on a slave tab
- Marc posts several messages to Mitchell in very quick succession
=> Mitchell gets crash error above.
This issue is caused by chat window being registered in mail manager
while it has not been mounted to DOM. On receiving 2nd new message,
it has to re-render chat window header in order to update displayed
unread counter. However, this fails due to chat window having no DOM
node yet.
This commit solves the issue by mounting chat window to DOM before
being registered in mail manager. That way, on receiving 2nd new
message, it does not trigger a re-render on chat window that
is about to be mounted to DOM, since it has not been registered yet.
Note that the displayed unread counter will be correct, because it
uses the up-to-date unread counter on mount.
Task-ID 2050108
closesodoo/odoo#35601
Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
This rev. makes the part of the progressbar corresponding to falsy
records 'alive': the user can now click on it to filter on records
whose value is false for the progressbar field.
Task 1952430
closesodoo/odoo#35100
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
*: mail,partner_autocomplete: adapted tests
Added a new function to trigger the adequate type of event on
an element (native JS event to DOM Nodes and jQuery event to jQuery objects),
and refactored the generic event-triggering functions to call this new function.