Commit Graph
168 Commits
Author SHA1 Message Date
Jorge Pinna Puissant ef424a9dc2 [REF] *: remove owl from linter's accepted global variables
Before this commit, owl was in the linter's accepted global variables.
This allowed  direct access to owl global object.

For instance, to use xml from owl, you could do :
`const { xml } = owl;`
or you could use it directly:
`owl.xml`

Now, owl is not accepted on linter's global variables anymore, so to
import xml, now you need to use a proper import:

`import { xml } from "@odoo/owl";`

task-id 3498859

closes odoo/odoo#137517

Related: odoo/enterprise#48364
Related: odoo/design-themes#709
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-05 10:21:53 +00:00
Michael (mcm) 2fbc08a197 [IMP] *: remove legacy service mappers
This commit removes the legacy service mappers which are useless now.

closes odoo/odoo#136807

Task: 3439226
Related: odoo/enterprise#48015
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-04 19:40:16 +00:00
Sébastien Theys 7a90938a70 [REF] mail, *: tests: simplify text option of contains
* = bus, calendar, im_livechat, hr, project_todo, sms, snailmail,
    test_mail, web, website_livechat

The current implementation often led to tests relying on DOM structure
to properly target the correct element with the text.

It is now easier to simply check if a parent contains some text.

closes odoo/odoo#136295

Related: odoo/enterprise#47770
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-09-23 10:33:04 +00:00
Sébastien Theys 7ea370fce7 [REF] mail, *: tests: refactor contains to further remove jQuery
* = account, base_iban, bus, calendar, crm_livechat, hr, hr_holidays,
    im_livechat, mrp, project, sms, snailmail, test_mail,
    test_mail_full, web, website_livechat, website_slides

Add support in `contains` for most operations that we use in tests.
Remove return value from `contains`.
Move into `web` module.
Remove import/export chains, directly import from correct module.

closes odoo/odoo#134652

Related: odoo/enterprise#47064
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-09-14 11:22:47 +00:00
tsm-odoo a188d9c894 [IMP] im_livechat, *: use guests for livechat visitors
*: crm_livechat, mail, test_discuss_full, website_livechat.

part of task-3332628

closes odoo/odoo#129770

Related: odoo/enterprise#45767
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-09-07 13:10:07 +00:00
tsm-odoo 1450747b3e [FIX] bus: fix single notification test
Before this commit, the "subscribe to single notification"
test failed in an nondeterministic fashion. This commit
solves this issue.

fixes runbot-24033

closes odoo/odoo#134243

Signed-off-by: Didier Debondt (did) <did@odoo.com>
2023-09-05 16:34:44 +00:00
Sébastien Theys e3b774118b [REF] mail, *: tests: remove most remaining afterNextRender
* = base_iban, bus, calendar, crm_livechat, im_livechat

Follow up of https://github.com/odoo/odoo/pull/130451

`contains` is faster and functionally more significant.

Part-of: odoo/odoo#134025
2023-09-04 21:53:37 +00:00
Alexandre Kühn 78c2dba93f [FIX] mail: show full company logo in avatar of message
Before this commit, avatar url of author of message always had
style `.o_object_fit_cover`, which makes a nice crop when
ratio of image does not match ratio of the `img`.

When the author of message is a company, it shows the logo of the
company, and it doesn't look nice to crop it.

This commit fixes the issue by using `.o_object_fit_contain` for
avatar of company, so that the logo is fully visible.
When displaying the avatar of a partner whose `is_company` is
undefined, the data is group-fetched, in order for models to
eventually know the value of `is_company` and use the correct
desirable showing.

Task-3381748

closes odoo/odoo#133311

X-original-commit: 48194366f2364e2eb9d99dc4fb71e2de83d8f7a2
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-29 12:36:01 +00:00
Michael (mcm) 629a046e03 [IMP] web,*: empty services/core.js
This commit removes almost all exports of the module services/core.js
(only the bus is left) and adapts the module that imported it.

task 3439226

Part-of: odoo/odoo#133153
2023-08-29 11:10:47 +00:00
Samuel Degueldre 6f95be6884 [REF] *: remove web.assets_common
*: auth_password_policy, bus, event, im_livechat, mail, mass_mailing,
mrp_subcontracting, point_of_sale, pos_self_order, project, stock,
survey, web, web_editor, web_tour, website, website_event,
website_forum, website_sale, website_slides, base

Historically, the web.assets_common bundle was used to contain assets
that were needed by both the frontend and the backend. In practice, this
caused a bunch of issues where people would add things in assets common
that were not needed by both, and it was also abused as a way to get
bootstrap working in unrelated places by only using that bundle's css.

Because of this, as a first step, the assets_common stop being used in
the frontend, but was left everywhere else.

This commit removes the bundle completely, and moves the files that used
to be in that bundle in the other bundles that need them, this will
allow those bundles to evolve independently going forward.

in im_livechat and mail, some of the unneeded legacy code was removed, this
allows us to avoind including all of the legacy code from web in the
livechat embed bundle and in the dicuss public bundle respectively.

closes odoo/odoo#132190

Related: odoo/enterprise#45884
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-08-24 15:11:05 +02:00
tsm-odoo 2cfafbbcaa [FIX] bus: keep user log in debug mode tests
Before this commit, the current user was cleared after every
test. This is an issue since we can still interract with the
page after the test is done when in debug mode. This commit
fixes the issue by clearing the current user at the beginning
of each test instead of the end.

closes odoo/odoo#132801

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-23 12:30:49 +02:00
Pierre Pulinckx (pipu) c07181b20b [REF] *: Replace env._t() by _t()
In this commit, all usages of env._t() are replaced by _t().
In templates files, env._t() didn't work because terms used
in attributes where not extracted into the translation files.
Only string are exported from .xml files to translation files.
So, to make it works, we set a variable that is then used
in attributes.
For example :

<t t-set="string_to_translate">String to translate</t>
<Dialog title="string_to_translate>...</Dialog>

task-3292454

closes odoo/odoo#131390

Related: odoo/enterprise#45631
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-18 19:17:16 +02:00
tsm-odoo 7131f7c626 [IMP] mail, *: add support for guests/dynamic users in tests
*: bus, calendar, im_livechat, web, website_livechat.

This PR adds the possibility to set the current user during tests as
well as the mail guest. This will be used to test mail guest page and
livechat once the visitors will be treated as guests.

part of task-3332628

closes odoo/odoo#130811

Related: odoo/enterprise#45331
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-08-09 14:36:12 +02:00
tsm-odoo cdc35aed74 [IMP] mail: add decorator to extract guest
This PR adds the `add_guest_to_context` decorator in order to provide a generic
way to extract the guest from a request. It will be used to unified guest
extraction from cookie/param based on its provenance (external livechat/public
page).

This is better than the `pre_dispatch` method since it can be applied to
specific routes instead of adding this logic to every request.

part of task-3332628

closes odoo/odoo#130052

Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-08-09 13:20:53 +02:00
tsm-odoo 7c932aa6c8 [FIX] im_livechat: use public user during tests instead of admin
Before this PR, the user during livechat embed tests was the admin partner while
it should be the public partner. This commit fixes the issue.

part of task-3332628

closes odoo/odoo#130429

Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-08-03 10:43:01 +02:00
Michael (mcm) 9d6b380a24 [REF] *: adapt patches after new patch function
In the commit [1], the patch has been refactored to support the
native keyword `super`. The current commit just adapts the codebase
to that change.

task 3410198

[1]: 19ea1ac08043e22a811630968e44715cc3bfc495

Part-of: odoo/odoo#125716
2023-08-02 17:29:05 +02:00
tsm-odoo 7b88ae4760 [FIX] mail, *: start bus service lazily
*: im_livechat, web.

Since [1] the messaging service is added to the livechat embed
bundle. As a consequence, the bus service is started even when
it is not needed. This is wrong since it would lead to lots of
useless connections to be made.

This PR prevent mail services from starting the bus eagerly in
this context and adds a tour in order to prevent further errors
on this matter.

closes odoo/odoo#130059

X-original-commit: b2bcef3c3b57061ef0694a5fc3c326cc8babc818
Related: odoo/enterprise#44782
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-08-02 13:20:11 +02:00
Pierre Pulinckx (pipu) 3bc94e52ce [REF] *:Replace moment usages with luxon
luxon and moment are both used in the solution,
but these two libraries facilitate the manipulation
of dates. It was decided to replace all uses of
moment with luxon so we can then remove
moment.js from the code and lighten the assets.

task-3391739

closes odoo/odoo#128752

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-07-31 19:02:45 +02:00
Bastien PIERRE 65242e31e9 [IMP] *: Remove alias in JS files
Rename all imports with alias old system to the new js module system
Task ID: 3266759

closes odoo/odoo#127414

Related: odoo/design-themes#671
Related: odoo/enterprise#43716
Signed-off-by: Bastien Pierre (ipb) <ipb@odoo.com>
2023-07-27 11:58:34 +02:00
Alexandre Kühn 8f38b5130c [FIX] bus, mail: message notif should not increment counter twice
Before this commit, a new unread message could contribute to unread
counter of conversation twice.

Steps to reproduce:

1. Log in as Demo and start a conversation with Mitchell Admin
2. Log in as Admin: if this is the first message in the conversation,
   counter is correct and shows (1)
3. Log out as Admin
4. Send another message to Admin
5. Log in as Admin and notice that the counter is doubled
6. If the conversation was still open, counter is correct!

This happens because some notification are pending dispatch before
fetching messaging state initially. The counter at init_messaging
fetch takes into account the notification. However, when handling
the message notifcation, it's wrongly considered as a new
notification, thus incrementing the counter when it shouldn't.

This commit fixes the issue by fetching the last bus notification
when fetching init_messaging. Doing so allow to determine whether
a notification is newer or older than init_messaging state.
This helps deciding whether the counter should be incremented or not.

Task-3357960

closes odoo/odoo#124767

X-original-commit: 081ab772dece86f1b5a5d4b3f6227b4b311d9206
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
2023-06-13 10:14:06 +02:00
Pulinckx Pierre (PIPU) f4f0f78318 [REF] *: Replace underscore.js function by native JS
Before this commit : The library underscore.js and
underscore.string.js were used in the ODOO solution.
After this commit : Every usages of a function from
underscore.js lib has been replaced with native javascript.
The goal is to remove all usages of underscore.js and to
not use anymore this library in ODOO.
---
TaskId : 3246238

closes odoo/odoo#120437

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-05-15 09:37:48 +02:00
tsm-odoo a3525aedbe [IMP] bus, *: add single notification subscription
*: calendar, iap_mail, im_livechat, mail.

Until now, one had to subscribe to the global "notification"
event of the bus service and to loop through each notification
to handle the one that was targeted.

This PR introduces the `subscribe` method on the bus service
in order to subscribe to a single notification type.

closes odoo/odoo#120893

Related: odoo/enterprise#40848
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-05-10 02:00:45 +02:00
Alexandre Kühn 187ad14840 [REF] bus: prettify bus files
closes odoo/odoo#119530

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-27 02:44:42 +02:00
tsm-odoo 2ba5818fac [FIX] bus: fix non-deterministic bus tests
Since [1], some bus tests were failing in a non-deterministic
way. This PR fixes the issue.

[1]: https://github.com/odoo/odoo/pull/119525
Fixes runbot errors: 20755, 20756, 19933.

closes odoo/odoo#119807

X-original-commit: c52670c9e91c369410422afacfbd9080d432e8bd
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
2023-04-26 15:06:48 +02:00
Alexandre Kühn 4ee10c2814 [FIX] bus, im_livechat: lazy start bus worker
Before this commit, the bus service was starting worker at page
load, regardless on whether the user interacts with chat features.

This commit starts bus worker only when it's really useful, e.g.
when adding a new channel to subscribe. Functionally, on livechat,
the worker does not start before the livechat is open.

Task-3266973

closes odoo/odoo#119528

Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
2023-04-25 07:37:56 +02:00
Sébastien Theys f9d7f7595f [FIX] bus, *: restore simple_notification handler
* = base_geolocalize, calendar, website_crm_partner_assign

Oversight of discuss refactoring. Code is restored into bus module as it
does not depend on any mail or discuss feature.

closes odoo/odoo#119243

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-04-20 19:30:37 +02:00
Michael (mcm) ff0d6dd580 [REF] *: replace odoo module by native one
This commit converts almost all odoo module by native module.
The goal is to deprecate odoo.define in favor of native module and then
simplify boot.js by removing the regexp that finds module dependencies.

task id: 3162300

closes odoo/odoo#117305

Related: odoo/enterprise#39118
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-03 17:07:24 +02:00
Didier (did) a5ca1895ac [IMP] mail: rename partnerRoot to odoobot
`PartnerRoot` is a confusing name for what is in fact what everyone call `odoobot`

closes odoo/odoo#116823

Signed-off-by: Debondt Didier (did) <did@odoo.com>
2023-03-28 17:49:01 +02:00
Sébastien Theys e8a4f4dce8 [IMP] bus, mail: make test data more consistent
In preparation of discuss refactoring.

closes odoo/odoo#115047

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-03-14 13:30:13 +01:00
Romain Estievenart 1b1925ac65 [FIX] bus: shared-worker feature detection
This commit fixes the shared-worker feature detection with using the
browser object alias.

Steps to reproduce:

- Log to Odoo back-end with a device without a shared-worker support
  like Chrome on an Android device => traceback

link:

https://caniuse.com/mdn-api_sharedworker

opw-3198778

closes odoo/odoo#113293

X-original-commit: 4aaafd46dbe1188bf2d9c0140a916ef664d99c42
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-02-21 21:08:00 +01:00
tsm-odoo f95c95b44f [FIX] bus: fix bus test undeterministic runbot error
Before this commit, the bus service test "tabs share message from a
channel" was sometimes failing. This is due to the fact that it was
only waiting a `nextTick` to receive the message but the message is
not guaranteed to arrive within a tick. Indeed, the message is first
sent from the worker `MessagePort` via `postMessage` then triggered
on the event bus via `dispatchEvent`.

closes odoo/odoo#113008

X-original-commit: a8d25a89a9fbdb9d51926df2c33c1f4b5eba9b3f
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
2023-02-18 02:49:48 +01:00
tsm-odoo d6589641cf [FIX] bus: shared-worker failing to start on incognito
Before this PR, the bus service's `SharedWorker` sometimes failed
 to initialized with data url. This error only occurred on some devices,
 on chrome and in incognito mode.

 While the specifications specify that `SharedWorker` constructor should
 handle data url properly [1], there is no way to tell whether or not the
 user browser supports it.

 This commit solves this issue by introducing a fallback on simple `Worker`s
 since they seem to handle data url correctly in this case [2].

[1] https://html.spec.whatwg.org/multipage/workers.html#dom-worker
[2] https://chromium.googlesource.com/chromium/src.git/+/9801daec162285a1f2c6695682ace5d508ea9b7f

opw-3146671

closes odoo/odoo#112921

X-original-commit: 99ac9538d6ba49161be37318fca541c7e51603f9
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
2023-02-17 08:12:26 +01:00
tsm-odoo 7df0ce5570 [FIX] bus: do not handle events of outdated websockets
Before this commit, late close events were not handled properly. This
could have led to non-reconnecting websockets. The problematic scheme
is the following:
- Close the socket (eg. upon the reception of an `offline` event), let's assume that
the other end will not perform the closing handshake, the connection will be
closed once the browser presumes it is dead.
- Create a new socket (eg. upon the reception of an `online` event)
- The browser assumes the connection is dead and dispatches a `close` event,
the worker switches to the `reconnecting` state and expects an `open` event  to
update its state to connected. Since there is already a running socket, the worker
won't open a new one and will never receive the `open` event.
- Server closes the connection  (eg. `KEEP_ALIVE_TIMEOUT`)
- The close handler is called but since it is in the `reconnecting` state, it assumes
it shouldn't do anything thus, no reconnect attempt is made.

This PR fixed this issue by ignoring events linked to outdated sockets.

closes odoo/odoo#112456

X-original-commit: a2454739156d8742f7606f090126f32735fb15df
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-02-10 18:52:22 +01:00
tsm-odoo d74057344d [FIX] bus: last bus subscription when switching offline/online
Before this commit, the bus worker would not subscribe to any channel
if the `_start` method was called before the socket was closed after
calling `_stop`. This is due to the fact that the close handler is
supposed to clean the last subscription when the socket is closed.

In this case, the handler is never called and the subscription is
considered already doned which is not the case.

closes odoo/odoo#111405

X-original-commit: 9e32c900e922674b4423407089cee58848ecdea1
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-02-03 11:45:32 +01:00
tsm-odoo fa028a18df [FIX] bus: make bus_service recover faster from offline/online switch
Before this PR, recovering from an offline/online switch could
take up to 20mn. Indeed, WebSocket are based on TCP that uses
FIN packets to close the connection. In case of a sudden loss
of internet connection, the client is unaware of the already
dead TCP connection. It is up to the browser to assume the
connection is dead after some time.

This commit solves the issue by closing the connection properly
upon the reception of the offline event. When the client is back
online, the connection is opened again thus allowing an almost
instant recovery.

At the same time, this PR increases the default keep_alive_timeout
for websocket connections. Indeed, those re-connections lead to cursor
usage bursts and are not required so frequently.

closes odoo/odoo#111274

X-original-commit: d3a3792e5247cc41a58b47d148d4adf4fb0e4631
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-02-02 18:46:02 +01:00
tsm-odoo 180a7783d1 [FIX] bus: do not use dbuuid
Before this commit, the dbuuid was added to the session info in order
to reset the last known notification id.

This is not necessary since #103025. Indeed, if the last notification
passed to the server is superior to the last one, the last notification
default to 0.

This commit removes this information from the session info.

closes odoo/odoo#111154

X-original-commit: 80c2d32009e07bef05cce0b53221c6a8ca024fb0
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-01-27 02:41:48 +01:00
tsm-odoo c40320eb15 [IMP] bus, *: remove bus service legacy session dependency
*: calendar, im_livechat, mail.

Before this commit, the legacy session was a dependency for the bus
service. This was problematic since one would need to import a bunch
of legacy files to fulfill this dependency in order to use it.

This commit removes this dependency. In order to pass parameters to
the `bus_service`, the `bus_parameters` service is now used.

closes odoo/odoo#110247

Related: odoo/enterprise#35974
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-01-19 12:30:44 +01:00
tsm-odoo cface47e4e [FIX] bus: websocket worker from different origin
Before this commit, the bus service would fail to initialize its worker
when loaded from a different origin than the worker script URL.
Moreover, the websocket URL was assumed to be on the same domain that
the bus service.

This PR fixes both issues:
- When the bus service is loaded from a different origin than the worker
script URL, create a data URL and use "importScripts" inside the worker
since it is not restricted to same origin scripts.
- Pass the websocketURL to the worker during its initialization.

opw-3118394

closes odoo/odoo#109701

X-original-commit: c1a480bb9ec133b9f94a5bb505380216a7f9c4ce
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-01-12 01:27:47 +01:00
tsm-odoo b28f06a2c6 [IMP] bus: lazy start of the websocket
Before [1], the bus was started lazily: either as a consequence of
the addition of a channel to listen to or by manually calling the
`startPolling` method.

Before this commit, the websocket would have been started as soon as
the bus service starts which degrades performances.

This PR fixes the issue by re-introducing the same mechanism as before
that is by starting the websocket either by calling manually the `start`
method of the bus service or automatically when adding a channel.

[1]: odoo#75510

closes odoo/odoo#108741

X-original-commit: 800e175c5bc5d8ba23265c69c5c2cab6957fc73a
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-12-28 11:42:53 +01:00
Samuel DegueldreandAaron Bohy 78188249ca [FIX] bus, web: clean up event handlers and message ports correctly
This commit fixes two things:

- The owl compatibility layer adds an `on` and `off` method on owl's
EventBus so that it can keep being used as it used to in owl 1. To do
this, it needs to keep track of the the callbacks that are attached to
it and by whom. To do this it keeps a Map where the "owners" are keys.
When calling `off` to remove event listeners, we remove the callbacks
but did not remove the owner from the Map, causing the EventBus to
always hold a strong reference to any object that was given as the owner
to the `on` method, preventing the item from being garbage collected.
Objects that do this are typically components, and components hold a
reference to their owl application that contains the entire tree of
components. This was particularly problematic in tests where components
are created and destroyed at a rapid pace.

- The mock websocket creates a MessageChannel so that it can mock the
server side of the websocket, but it never closes that MessageChannel's
MessagePorts, which can cause garbage collection to be slow to happen
[1] (in practice it looks like these are basically never garbage
collected unless closed). This commit registers a cleanup to close the
message ports after the execution of the current test.

[1]: https://html.spec.whatwg.org/dev/web-messaging.html#ports-and-garbage-collection

closes odoo/odoo#108309

X-original-commit: 4facc396a4e8036592a473002253d5a5daf41a19
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2022-12-19 16:49:06 +01:00
tsm-odoo 65596c484f [IMP] bus: ensure update channels always come first
Odoo sh needs the update channel event to always come first.
This PR ensures it will always be the case.

closes odoo/odoo#107971

X-original-commit: 1f29e7bec160c1fa6930b3ee8b7753150253a7e2
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-12-14 17:18:09 +01:00
tsm-odoo 252f7f5f82 [IMP] bus: lazy start of the websocket
Before [1], the bus was started lazily: either as a consequence of
the addition of a channel to listen to or by manually calling the
`startPolling` method.

Before this commit, the websocket would have been started as soon as
the bus service starts which degrades performances.

This PR fixes the issue by re-introducing the same mechanism as before
that is by starting the websocket either by calling manually the `start`
method of the bus service or automatically when adding a channel.

[1]: odoo#75510

closes odoo/odoo#107878

X-original-commit: 5d7deacf54f37f0938b92a3c45c9f1d1325d1a9f
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
2022-12-14 14:19:58 +01:00
tsm-odoo 48c9600186 [FIX] bus: presence service returning wrong value
Since #106454 the `isOdooFocused` variable is not updated correctly.
This commit fixes this issue.

closes odoo/odoo#106556

X-original-commit: 0e9351e7bfda370a994a4cc38383bf7d5547dac8
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
2022-11-25 18:55:05 +01:00
tsm-odoo 2b9a901b99 [FIX] bus: prevent crash of presence service for cross origin iframes
Before this PR, the presence service would crash on cross-origin
iframes. This is due to the fact that accessing the parent document
of a cross origin iframe is forbidden for security concerns.

This error was introduced when trying to synchronize the website iframe
and the window focus state in #102479.

This PR fixes the issue by catching the error and fallbacking to the old
behavior given than task-3006023 has been fixed by #53143 anyway.

task-3073242

closes odoo/odoo#106499

X-original-commit: 7210c50df89dce68a554c6d685c33ce74e09d30c
Signed-off-by: Stockbauer Matthieu (tsm) <tsm@odoo.com>
2022-11-25 10:52:21 +01:00
Pierre Paridans ebd149857e [FIX] bus: SharedWorker is buggy on iOS 16.1
Since the iOS 16.1 update, the WKWebView used in the iOS mobile app
crashes when trying to instanciate a `SharedWorker`... even if this
feature was newly added in iOS 16.0.

Safari iOS doesn't seem to be impacted.

This commit works around this issue by disabling the usage of the
`SharedWorker` in the iOS mobile app, using instead the existing
fallback to a regular `Worker`.

Steps to reproduce:
- On a device running iOS 16.1
- Open Odoo in the iOS mobile app
=> Once connected the app freezes with a gray screen

opw-3045539

closes odoo/odoo#104459

X-original-commit: afac382bd711b1a506629742456d91526cc52c53
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-10-28 14:21:13 +02:00
Didier (did) 365f5a9863 [IMP] mail: introduce notification handler mail.record/insert
Some of our current bus notification only insert data in the models system. We
can now simplify the way we handle them by using a generic `mail.record/insert`
handler.

closes odoo/odoo#102863

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-10-21 15:19:18 +02:00
tsm-odoo 7277275d06 [FIX] bus: restore current partner in pyEnv
Since [1], `pyEnv.currentPartner` has been removed. This was
a mistake since this information is still used during tests.

This PR restores it.

[1]: https://github.com/odoo/odoo/pull/98374

closes odoo/odoo#103544

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-10-19 18:06:50 +02:00
tsm-odoo fc1613f68a [FIX] bus: adapt presence service to work with iframe
Before this PR, the presence service was relying on window events
blur/focus to determine whether or not odoo was focused. The issue is
that in the website backend, an iframe is used. When this iframe is focused,
the window looses the focus and vice versa.

This commit fixes this issue by using `window.parent.hasFocus` method.

task-3003950

closes odoo/odoo#102518

X-original-commit: ce57d4494f2bc6a1504f8a7bddddca2a3d2b794b
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-10-06 23:14:16 +02:00
tsm-odoo cc462a0be4 [IMP] bus: throttle update bus presence method
Before this commit, the `updateBusPresence` method could have been
called many times in a row, resulting in many `update_presence` messages
being sent through the socket. This commit solves this issue by throttling
this method in order for it to only be called once in `UPDATE_BUS_PRESENCE_DELAY`
seconds.

closes odoo/odoo#102442

X-original-commit: 0b581f5af509040928babf0e892732c0f4c873e5
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-10-06 19:04:11 +02:00
tsm-odoo 9e4a8dc43f [IMP] mail, *: split mock server by model/controller
*: bus, calendar, hr_holidays, im_livechat, note, rating, snailmail,
website_livechat.

The mail mock server is getting bigger and bigger. As a consequence,
navigating/keeping it up to date is quiet inconvenient.

This commit solves this issue by splitting it by model/controller.

closes odoo/odoo#98374

Related: odoo/enterprise#32314
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-10-06 19:03:49 +02:00