When a 'scheduled_date' is given to posting API notifications are delayed.
They are send using a cron running on a schedule model. However SMS are
not respecting this parameter. This is now fixed.
We also use sql.now() instead of datetime.now() when checking notification
delay. This leads to values that are consistent through the transaction
and avoid non deterministic behavior.
This leads to fixing a global mock of "cr.now" that has unexpected side
effects in composer tests. Indeed now that the scheduled notification checks
cursor now instead of datetime now this global mock leads to some notification
not being sent. We now mock cr.now() only for creating records, allowing
to effectively test templates using create_date for dynamic scheduled date
computation.
closesodoo/odoo#150911
Related: odoo/enterprise#55052
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Before this commit, when no conversation was selected in the
Discuss app, folding a category such as "Channels" results in
a crash.
This happens because `store.discuss.thread` is `undefined`, so it
must be properly guarded in the template of discuss sidebar category.
closesodoo/odoo#150828
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Before this commit, when a message without bubble layout
is squashed (e.g. with `/who` command twice in a channel),
mouse-hovering on the squashed message pushed increased the
height of the message.
This happens because the sidebar of squashed message contains
the date and it uses 12-hour format with AM/PM.
This design requires cautious use of content in the sidebar,
and had 24-hour format to make it work. A recent refactoring
changed it to 12-hour format as localization was a better concern.
However, the UI is not designed for it, and there's not much value
in having 12-hour format rather than 24-hour format. Indeed,
users assume AM if no AM/PM is shown, except if hour is greater
than 12 which is quite obvious the current time.
12-hour format is best for some users, but we can't have it without
overhauling parts of the UI which is not worth it at the time of
this commit. Therefore using 24-hour format is the better tradeoff.
Also took the opportunity of this PR to better align the date and
seen indicator in squashed message sidebar.
Task-3637270
closesodoo/odoo#150369
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Now that code is fixed there are more access to channel members and partners
to send them push notifications notably. Some tests are crashing when public
users access channel pages and perform actions that send push notifications.
Task-3695571
Related to Task-3669738 (Mail: Web Push Models Rename and Fixes)
Part-of: odoo/odoo#150011
Backport of odoo/odoo@1955c55f86
Sending notifications can be delayed by giving 'scheduled_date' as parameter
for notification process. This is used notably when a process in several
steps should wait for some user input before sending notifications e.g.
rating feedback and update done in two steps.
Sending web push notifications should respect this scheduling as already
done by inbox and email notifications.
Task-3695571
Related to Task-3669738 (Mail: Web Push Models Rename and Fixes)
Part-of: odoo/odoo#150011
Backport of odoo/odoo@24ebd74dc9
Recipients on a channel notification are computed twice: once using an
override of '_notify_get_recipients' that fetches information of mentioned
recipients; once in override of '_notify_by_web_push' to try to add
recipients for push notifications.
However this is not the right way to do it. Everything should be computed
in '_notify_get_recipients', setting the right 'notification_type' and then
let 'notify_by_MEAN' methods deal with their recipient input.
In this commit we now correctly compute recipients on a given channel
* mentioned partners;
* unmuted members on chat channels (push);
Task-3695571
Related to Task-3669738 (Mail: Web Push Models Rename and Fixes)
Part-of: odoo/odoo#150011
Backport of odoo/odoo@f312762c6a
'_notify_thread' calls '_notify_thread_by_web_push'. There is therefore no
need to call it once again in discuss.channel override of '_notify_thread'.
Task-3695571
Related to Task-3669738 (Mail: Web Push Models Rename and Fixes)
Part-of: odoo/odoo#150011
Backport of odoo/odoo@e3125c8389
A lot of keys are missing compared to standard '_notify_get_recipients'.
This is done in two methods that are updated to include keys defined
in 'MailFollower._get_recipient_data()' that contains the reference
structure to return.
Task-3695571
Related to Task-3669738 (Mail: Web Push Models Rename and Fixes)
X-original-commit: 7a46a957764aa5ee97a0a183fa1b747de85ff8ac
Part-of: odoo/odoo#150011
Just extract some code we should otherwise copy in both mail_mobile and
mail_enterprise.
Task-3695571
Related to Task-3669738 (Mail: Web Push Models Rename and Fixes)
X-original-commit: a6b0e88d00e1dcd4abbc1e37d62d65063c6956de
Part-of: odoo/odoo#150011
How to reproduce:
- Install contacts
- Go to any contact
- Schedule an activity on the contact by clicking on "Activities"
The flag automated of the created activity is set to True which shouldn't be
the case (you can check either in the DB or by adding the field with studio).
The same happens when scheduling plan, scheduling activities on multiple
records in the view list or a plan on multiple records.
This fixes the problem by modifying the activity schedule wizard so that it
always creates activities with automated flag set to False.
Note that that flags is used to distinguish activities created manually from
those created automatically. Some flows automatically cancel automated
activities (e.g. cancel 'validate my ticket') but those should probably not
cancel user defined activities (e.g. 'ask customer to pay'). That's why we must
ensure that activity created manually have that flag set to False.
Task-3691827
closesodoo/odoo#149965
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Default_from on alias domain is currently managed like bounce or catchall.
We consider it is always only a left-part of an email address that should
be completed with alias domain name.
However and notably at migration default_from could contain a complete
email address. In that case better be defensive and keep the domain part
of the value.
Task-3690919
closesodoo/odoo#149887
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
'_redirect_to_record' is used notably when accessing 'mail/view' controller
used notably with email notifications ('See Document' link). In order to
try to avoid multi company issues a call to '_get_mail_redirect_suggested_company'
is performed in order to find the record's preferred company.
However it is defined on 'mail.thread' which means the redirect crashes if
invoked using a non thread record. This is quite rare but may happen with
models using a mailgateway implementation similar to 'mail.thread' without
inheriting from the mixin (see 'mail.group' model added in Odoo 16).
This limitation is present since a long time but is now more present since
odoo/odoo@f4523fcd92 .
Task-3689459
closesodoo/odoo#150309
X-original-commit: 9a366dcdb789d0f160871ee4d29a463e2641ca26
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
The Ptt extension makes use of the `chrome.session` API to keep track
of the connected clients. Before this PR, the session storage was
initialized at the top level of the background script. This is an
issue since it will be executed after the service worker wake up thus
overwriting the existing client map. This PR removes this
closesodoo/odoo#150084
Initialization: the map will be created when needed instead.
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Before this commit, editing a message in message in a conversation
and then pressing on the paper plane icon was throwing the following
error:
```
TypeError: null is not an object (evaluating 'thread.model')
@_sendMessage
```
This happens because this button was in "send" message mode rather
than in edit mode. Since we cannot post a message while editing a
message, the crash happens because composer is not related to thread
but the message.
This button is not visible in desktop mode, and user should use
suggested keyboard shortcuts or click on links to either save edit or
discard it. In mobile, these interactions are not intuitive.
This commit fixes the issue by keeping the paper-plane button while
editing in mobile but it acts as "save". The labels to save/discard
was not appropriate in mobile, so it has been turned to a simple
button to discard editing.
opw-3670482
closesodoo/odoo#148918
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Before this PR, the "Retry loading more messages on failed load more
messages" test was sometimes failing. This test uses the `afterEvent`
helper to wait for the load message event to occur. This is too
technical and not reliable: this test just ensures that clicking on
the retry button after failing to load more messages work as expected.
This PR simplify this test and make use of the `contains` helper which
is more reliable to do so. First, 30 messages are loaded, then the
retry button appears and finally, clicking on the retry button should
load 30 more messages for a total of 60.
fixes runbot-53201
closesodoo/odoo#150012
X-original-commit: 6c1f3f0a24913484042148b7101ec6a628d5b8be
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
Before this commit, opening chat window from messaging menu
might not work.
Step to reproduce:
- open Discuss app
- Go to home menu
- Reload the page
- Click on Messaging Menu
- Click on chat item to open chat
=> Chat window is not open
This happens because when in the home menu from Discuss app
in background page reload, the URL contains the Discuss app
menu_id, but the action is "menu" rather the action id. This
difference is crucial to distinct discuss app being actively
open or it's in the background from home menu. The latter
should NOT consider Discuss app being open.
This is not a problem when opening/closing Discuss app, because
the mounting/unmounting of the Discuss app component is good
enough to detect that. However, with page reload, the way to
detect Discuss app being open from URL was only relying on `menu_id`
instead of `action` value.
This commit fixes the issue by checking `active_id` of discuss app
rather than `menu_id`, as `active_id` is 100% reliable whereas
`menu_id` is not. The problem with home menu is one example among
many other cases (e.g. page reload in channel settings form view).
closesodoo/odoo#149969
Related: odoo/enterprise#54638
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
*: mail
This commit fixes the behavior of the notification to install the PWA.
The initial spec was not completely achieved, since the 'Dismiss' button,
using the fa-close icon was not present. See task-3275275.
Now, the button is present, and it can hide the notification and the user don't
need to interact with the installation prompt to dismiss it.
The fix also fixes the behavior of the notification when being used in
an incognito tab. The installPrompt service assumed the PWA could be
installed, since window.BeforeInstallPromptEvent is defined. But in an
incognito scenario, the event was never actually triggered, since the
feature is disabled by the browser.
This could finally create a UX issue if the app had been installed, and the
localStorage cleaned. The notification would appear, but wouldn't do anything
when clicking on the Install button since the event is no longer triggered by
the browser. Now, we rely on the trigger of the event exclusively, except on
Safari, where we rely on the installationState and the standalone display-mode.
Now, the service only set its state when the event has effectivelly been
triggered and the native prompt can be called. Since the UI relies on the
state from the service, the notification is no longer shown.
Tests have been adapted, to dispatch a custom event, allowing the service to be
initialized as if it was in a situation where the PWA can be installed effectively.
A new test have been added to verify the interaction with the close icon.
closesodoo/odoo#149961
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
Since [1], the `insert` method accepts the `html` option to
automatically cast record fields marked as `html` to markup. Before
this PR, this option was ignored after the first insertion if the
field value remained the same.
Steps to reproduce this issue:
- Insert a message without passing the `html` option: the body field is
an instance of string.
- Insert the same message setting the `html` option to true: the body
field of the message is still an instance of string while it should be
an instance of markup.
This PR fixes this issue.
[1]: https://github.com/odoo/odoo/pull/139501closesodoo/odoo#149953
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
Before this commit, any new message in a channel of type "channel"
was automatically opening a chat window and showing new message
counter in tab title when out-of-focus.
This behaviour is only intended for important messages. In chat
(group chat, DM chat, livechat), all new messages are considered
as important so this is good. However, for channels, these are
intended for communication with many users, and we only want to
notify on messages that are explicitly flagged as "needaction".
As a reminder, message are needaction through `@mention` or
reply-to for example.
This commit fixes the issue by limiting notifying out-of-focus of
new messages in channel "channel" to only needaction. Also the
auto-opening of chat window as a consequence from this new message
is also limited to needaction messages.
closesodoo/odoo#149943
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Before this commit, when looking at old messages of a message,
clicking on "Jump to present" was frequently not scrolling to
most recent message.
This happens because loading messages is not immediate, and thread
UI has some heuristics to adjust scrolls that were working against
scrolling to present when the RPC to load messages around present
is not immediate.
This commit fixes the issue by handling the actual scroll to present
in the same workflow as all other scroll adjustments. Also the logic
for adjusting scrolls requires immediate scrolling, hence this commit
has to remove smooth scrolling to comply with current scroll
adjustment techniques.
closesodoo/odoo#149915
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
The webclient returns a message "server error" if you add an attachment or send
a message on an archived record chatter.
steps to reproduce:
- archive a record (ex: a partner)
- send a message on the chatter or add an attachment
before this commit:
- a popup error is raised "server error"
after this commit:
- the chatter is working properly on archived records
opw-3689169
closesodoo/odoo#149862
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Steps to Reproduce :
1. Open Email Marketing
2. Type a long text in the subject line
3. You will notice that the content gets overlapped over the emoji icon
Observed behavior:
content getting overlap over emoji icon
Expected behavior:
the content should be hidden by the emoji icon
Task-3628324
closesodoo/odoo#149918
X-original-commit: 80c96838a4d16a821aaf11e04ca2776f6a884507
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Sanket Brahmbhatt (sabr) <sabr@odoo.com>
This reverts commit 185adf6fb487fa260bb6dfe985638bc545de7fa2.
The change was made to "fix" line breaks with rating feedback in
helpdesk. However, it's not ok to apply `inline` display layout
for all non-user made message body, as usual block display is
expected for html tags like `<div>` or `<p>`.
The correct fix should be to remove these unwanted `<br>` in the
feedback rating messages. We don't know how they appeared, but
this is a specific minor issue in helpdesk rating, so reverting
the fix is a higher priority.
closesodoo/odoo#149570
X-original-commit: 1ba04da76f391cd4543a8d3b1e6dbecf6a2cb558
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Currently the form sheet have a flex-grow-1, the chatter could use less
horizontal space to leave more space for the form sheet's content.
This commit widen the form_sheet by applying a flex-grow-2 and
reduces the chatter's top bar total width by removing the icons and
applying a sup tag on the micro information displayed aside the icons.
Since the icons are removed there is no need to test if the icon is
rendered with it's appropriate text anymore thus we can remove these
two lines. Additionally the `text-warning` on the span was unnecessary
since it's already applied on the button parent.
task-3641988
closesodoo/odoo#147136
Related: odoo/enterprise#53208
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
In large database, the time to unlink a sale.order (or any record with mail.thread) can be take 1 seconde.
After it is so fast.
closesodoo/odoo#149296
X-original-commit: 6bd9f408a18c019416b5bd981de50b54432f5690
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
*: mail, pos_sale, pos_self_order, website_sale
=== `oi-close` adaptation ===
Prior to this commit, `oi-close` icon was based on the default
sans-serif font. Depending on this, there could be alignment and size
inconsistencies with the Odoo UI icon library.
This commit adapts `oi-close` to use a custom icon from the UI icon
library to make it more robust and maintain consistency with this
library.
=== corner arrow icons adaptation ===
Prior to this commit, directional icons related to the four corners were
misaligned.
This commit adapts these four icons so that they are properly aligned.
task-3618046
closesodoo/odoo#144598
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
do not compare types, for exact checks use `is` / `is not`,
for instance checks use `isinstance()`Flake8(E721)
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
A model can specify a preferred company (cid) when redirecting someone from a mail
link.
Before this commit, this cid was taken into account when redirecting only if the
user is logged in.
With this commit, even if the user is not logged in, the redirect link will take
that preferred cid into account.
opw-3613144
closesodoo/odoo#149254
X-original-commit: e70a27d820d94dba7e8c45865ddc5fbc46f9f26f
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Adrien Milis (miad) <miad@odoo.com>
Purpose
=======
When a database is miss-configured, we have no other choices to
potentially spoof the FROM. We decided that a better heuristic would
be to use the notification email instead of the user email.
Task-3645895
closesodoo/odoo#149189
X-original-commit: eae9214ade8487ac326fc83abe67af53d861e00a
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Label of guest name on public discuss welcome page
was gramatically incorrect. It should be "Logged in as"
rather than "Logged as".
Also took the opportunity to properly translate the label.
closesodoo/odoo#149187
X-original-commit: 9463c787e7804e5c2c525b9ecc096ee067f0dd3d
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
In this commit we have fixed the line break issue when we submit a feedback
for task and ticket.
steps:
- Install helpdesk
- Go to helpdesk > team
- Activated customer rating
- Set the rating template in the ticket stage
- Create a ticket with the customer and move to the next stage
- Open the mail and submit a rating and message
- Open ticket and check customer message
task-3268763
closesodoo/odoo#148644
X-original-commit: 185adf6fb487fa260bb6dfe985638bc545de7fa2
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
Steps to reproduce:
- Install `CRM` module (for test purposes)
- Create a lead and set the name, email, phone, company name and
contact name
- Save the lead
- Click on `Send message` button in the chatter
- Uncheck/Check the recipient checkbox
- Save the partner
- Discard the changes on the lead and open the partner created
Issue:
- In the wizard, the `phone` value is not set with default value and
the name is set with the company name instead of the contact name
- On the partner created, the company and phone are not set
Cause:
The default values (used in the partner creation wizard) retrieved
from "/mail/thread/data" route are not set on the recipient object.
opw-3512045
closesodoo/odoo#148213
X-original-commit: 372fe2fe61e3121b27bf1305dfac8fbf0ff8e9b5
Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
Fix various use case of HTML encoding / escaping in mail flows. Depending on
functional flow HTML entities could appear as they were not correctly
managed as valid HTML.
Notably when managing attachments in '_process_attachments_for_post' we
should return Markup-ized HTML to be sure it is considered as valid in
other post processing.
Task-3675159 (Mail: correctly escape HTML when updating content)
Task-3619348 (Mail: propagate markup flag when processing attachments)
closesodoo/odoo#148769
X-original-commit: f4bf63077d4129807e00e15b833e47623869491f
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
The problem was the hard coded `@Mitchell Admin` in the expected result.
The case can be different when the demo data changes.
Change the test and make it fixed in all cases.
closesodoo/odoo#148710
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit adds the simulcast feature to calls when relayed by an odoo
SFU server, this allows for better bandwidth management by scaling down
resolution instead of losing packets.
closesodoo/odoo#148276
See: https://github.com/odoo/sfu/releases/tag/v1.1.0
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Before this commit, it was possible that an attempt to update
peer connections made right at the moment the connection was swapped
from peer-to-peer to server mode. Which would cause a traceback.
This commit fixes this issue by checking if there is a
`RTCPeerConnection` before trying to update it.
closesodoo/odoo#148505
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Before this PR, I guest searching in discuss would get an access error.
This is because the search is searching in the attachments that the guest can't
access.
task-3637314
closesodoo/odoo#146110
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit simply replaces the shortcut for the action_done_schedule_next
buttons from alt+q to alt+z in the activity view dialog because the
alt+q shortcut is already used for the Save/Schedule buttons. This was
already done in https://github.com/odoo/odoo/pull/145738 but the wizard
which appeared in 17.0 hadn't been corrected.
opw-3565747
closesodoo/odoo#148160
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
When a message had more than 1 attachment, it was not possible
to preview the attachment on a mobile device.
This happens because the hover buttons for delete/download the
file took the whole clickable area of attachment to see the preview.
To enable quick actions in mobile, this require non-trivial UI
tweaking. To match behaviour of version 16.0, these quick-actions
have been disabled in mobile.
opw-3664795
closesodoo/odoo#148091
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Internal code doesn't need to use reactive when reading store or Model,
especially not in `insert` that is not meant to access anything observed
except when actually writing records (in which case `_proxy` is used).
The `get` part of `preinsert` (and its full chain) must be kept with the
full proxy however, to ensure proper trigger of reactive callback when
returned record changes.
Part-of: odoo/odoo#147814
There is no need to go through the proxy to assign localId as nothing
should observe it at this step, and it shouldn't change anyway.
Part-of: odoo/odoo#147814