Commit Graph
12356 Commits
Author SHA1 Message Date
Hubert Van de Walle (huvw) 706d2f01ae [FIX] web: basic_renderer: delay destroy after render when rerendering widget
Steps to follow

  Edit the account.move view (with studio for example)
  Set the lines readonly property to [["partner_id","=",False]]
  Create a new move
  Add a partner
  Add a product
  Remove the partner
  -> A traceback appears: widget.$el is undefined

Cause of the issue

  widget.$el is used after the widget has been destroyed

The fix was already present in 14.0 (3fd7b2009e)
but we still need to keep the test

opw-2557142

closes odoo/odoo#79261

X-original-commit: 71e6d7e510ff9d44fe8deb16f29d50b021709074
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2021-11-02 13:11:34 +00:00
Michael (mcm) df72d187e1 [IMP] web: add "unique" array utility function
This commit adds "unique" array utility function which
returns a copy of the given array but without any duplicates.

closes odoo/odoo#76472

Related: odoo/enterprise#20833
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-02 10:45:15 +00:00
Michael (mcm) 13686e0e19 [IMP] web: http service in webclient test helper
Before this commit, `setupWebClientServiceRegistry` didn't use
http service but some tests need it.

Part-of: odoo/odoo#76472
2021-11-02 10:45:15 +00:00
Michael (mcm) d1c8a565ab [IMP] web: add pager to new framework
Before this commit, Pager was not implemented in the new framework.

Part-of: odoo/odoo#76472
2021-11-02 10:45:14 +00:00
Michael (mcm) 3ef8083dcb [FIX] web: autofocus conditional element
Before this commit, useAutofocus hook used the effect dependency
to check if the target is in dom but this dependency is computed
in onWillPatch and can be outdated when checking it in onPatched.

Now, the target isn't a dependency anymore and is computed just
before the check.

Part-of: odoo/odoo#76472
2021-11-02 10:45:14 +00:00
luvi 8e09f540d0 [IMP] web: clamp util and touch event helper
This commit adds touch events helper for tests and new util used
to constrain a number between two values. The purpose of
the commit is to introduce the ActionSwiper component using those
functionnalities.

closes odoo/odoo#78426

Related: odoo/enterprise#21712
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-29 17:20:06 +00:00
Francois (fge) 6470606d65 [FIX] web: Command Menu with custom icon
Before this commit, if you create a new app with a custom icon with
studio and you open the command palette with the namespace "/", then
you will have an error message.

We have this error because the home_menu does not support custom menu
icons.

closes odoo/odoo#79158

X-original-commit: c5f5b1de07ee6b8b09ae1821c4c0debc0d09f55e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-29 06:09:07 +00:00
Aaron Bohy e3f08513c2 [FIX] web: router: do not push unnecessary entries in history
Before this commit, the router didn't considered as equal an
integer value given as an integer or as a string (e.g. "1" or 1),
whereas form the url point of view, it's exactly the same, and the
information is lost anyway.

As a consequence, pushing something like { id: "1" } in the url
that already contained id=1 created a new entry in the history,
which isn't what we want as the url is the same.

This commit fixes the issue by converting string values into
numbers when it is possible.

This commit also changes the way the action service pushes the id
and active_id in the url, as there's no need to pass string values
anymore (this was the case in the early days of the wowl branch).

closes odoo/odoo#79132

X-original-commit: e576155fc55e0493a1d1236960dd1c7a36db9e8c
Related: odoo/enterprise#21948
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-28 13:06:00 +00:00
Simon Genin (ges) 5f5e699baa [FIX] web: Form stat button stays correctly disabled
A stat button set as disabled was used to just show some statistics
without an action on click. However, on tasks executed by the Form,
all the buttons would be temporarly set as disabled then set back to
enabled. This would lose the original state of the button and make them
all clickable.

The way it worked before v14.5 was most likely because the action
manager would not throw an error on an action with those "invalid"
arguments.

Also, a button without a type and name will now be set the disabled
attribute automatically.

closes odoo/odoo#78839

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-27 21:53:57 +00:00
luvi 29f83c0306 [FIX] web: missing template when editing ControlPanel
This fix adresses an issue when editing the control panel from Owl based views.
Currently, if you don't have a custom search to an Owl view, the template editor will appear blank as the component misses its searchViewId value from its props.
The commit also introduce a test when clicking the edit ControlPanel button in that case.
With the fix, you can edit the search template and get the default template

closes odoo/odoo#79023

X-original-commit: f5c8e855f07d68a34dccd9977b53999911a66f62
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-26 19:40:51 +00:00
Mohammed Shekha d4727f4424 [FIX] web: support readonly attribute on toggle_button widget
before this commit: applying readonly attribute on toggle_button doesn't work,
toggle_button still clickable and value is still changed even though widget is
readonly, there is no effect of readonly attribute on toggle_button widget.

after this commit: if toggle_button widget has readonly attribute then it will
not be clickable, button of toggle_button will be disabled so that user can
easily understand that element is not clickable.

task-2339995

closes odoo/odoo#79012

X-original-commit: 74d42d4a328c517d0ced56d9e437fb40b00a14d0
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-26 13:23:24 +00:00
xO-Tx 23fe084c4c [FIX] web: fix menu items width calculation
ISSUE:

The width of menu items is computed (in 'initAutoMoreMenu')
to check for overflow and fold extra items in a "+" dropdown.

[1] When the page is not in cache yet, the width is computed
while font is not loaded yet and the value obtained is not
the same when font is already available [2] (e.g. if we go
to another page).

This explains why we get an additional folded item comparing
[1] and [2].

The goal of this commit is to fix this behaviour by recomputing
the width after font loading.

IMPORTANT REMARK:

When the code was overridden on 'initAutoMoreMenu', the idea
was to update the menu as soon as the DOM is available and add
adjustments after in this order:

[A]- _adapt();

[B]- await _afterImagesLoading(...);
   _adapt();

But since it's not possible to prevent the changes in menu
width after images are loaded, we remove the first update
in [A] (This update has no effect in current code because
it was placed after the "await..." in [B]).

And we still start the updates on menu after image loading.

task-2618929

closes odoo/odoo#78959

X-original-commit: 69b97d8e95da3efa62882228e79dc357e19e0fe6
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-26 07:48:01 +00:00
xO-Tx 04f09503b2 [FIX] web, website: fix initAutoMoreMenu on user navbar
The current code in 'initAutoMoreMenu' doesn't work properly
on navbar after the update on dropdown in [1]. Small tweaks
were added in this commit to fix that.

[1]: 84715436d87bb05b421bc9ccaacda67d07571690

task-2618929

X-original-commit: 29b9280c44534d2f210dbcea83e0049365949f48
Part-of: odoo/odoo#78959
2021-10-26 07:48:00 +00:00
Xavier Morel 468eb84fb4 [FIX] web: race-ish condition in qweb test suite
By delaying the check of `didLogInfo` until run end, it becomes
possible for the test suite to start running before all the test
modules have loaded, which leads to some of the modules loading after
the test suite "ends" and start running at that point, leading to
multiple teardowns of the test suite.

This would occur in the POS test suite, leading to the `QUnit.done`
callbacks running multiple times, and multiple `"test successful"` to
be emitted.

This has historically not been an issue (hence having remained
undiscovered), but with the "success state" being a `Future` it now
breaks the corresponding test, as a resolved future can not be
re-resolved.

Part-of: odoo/odoo#77735
2021-10-25 09:53:11 +00:00
Xavier Morel 7962484c81 [FIX] web: make loading promise boolean-returning,
The new handler changes the behavior of `wait_ready`: before it would
wait for the `ready_code` to be `true` *or a settled promise*.

Now it waits for `wait_ready` to resolve to true, whether it's a
promise or not.

Part-of: odoo/odoo#77735
2021-10-25 09:53:11 +00:00
Xavier Morel f22d2cf595 [FIX] web: test hit position
Apparently the calendar now suffers from 94018575c6 on the brand new Chrome 94...

Part-of: odoo/odoo#77735
2021-10-25 09:53:10 +00:00
Achraf (abz) a7a932c7fd [FIX] web: Fix components position in modal
When a componentes is in a modal and uses the positioning hook (filter dropdown in the Search More modal for example), it will shifted from the toggler button.
This is due to a `-webkit-transform: translate3d (0, 0, 0);` applied on the `modal-body`
which influences the `position: fixed` attribute of `.o-popper-position` in the `dropdown-menu`

"It is positioned relative to the initial containing block established by the viewport,
except when one of its ancestors has a transform, perspective,
or filter property set to something other than none (see the CSS Transforms Spec),
in which case that ancestor behaves as the containing block. "

See: https://developer.mozilla.org/en-US/docs/Web/CSS/position

the translate3d was applied with https://github.com/odoo/odoo/pull/20314
As the bug is no longer exists, we can remove this style.

opw-2668638

closes odoo/odoo#78775

X-original-commit: 1f86e285aeb69578378cc89771cd090cc29ccc7d
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Achraf <abz@odoo.com>
2021-10-25 08:42:58 +00:00
Bruno Boi 6fe52c9012 [FIX] web: adjust FullCalendar for luxon v2
See preceding commit

closes odoo/odoo#78797

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-22 09:52:44 +00:00
Bruno Boi d2cdcd9058 [IMP] web: update luxon from 1.25.0 to 2.0.2
See [upgrade guide](https://moment.github.io/luxon/#/upgrading?id=_1x-to-20)

Part-of: odoo/odoo#78797
2021-10-22 09:52:43 +00:00
Louis Wicket (wil) 7c76f29111 [FIX] mail, web: properly add messaging menu to the systray
This commit intends to fix two strange bugs encountered while trying to
push a new component into the systray menu:
- MessagingMenuWidget and RtcActivityNoticeWidget were removing their
parent node via DOM manipulations when attached in the DOM. This caused
a crash when adding other items to the systray menu since the deleted
nodes were actually managed by OWL.
- The t-foreach directive in the navbar used indexes as the t-key, which
led mapping items subsequently added to wrong templates.

closes odoo/odoo#78784

X-original-commit: 5f0f80da4fc951954d253c9e45defd591605f556
Related: odoo/enterprise#21829
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Ooming <oomsveta@users.noreply.github.com>
2021-10-21 18:02:06 +00:00
Nidhi Patel f5db920f0b [FIX] project,web: fix project status color in kanban progress bar
Currently, projects that are 'on hold'  stage are represented in grey in
the kanban progress bar while the colored dot on their card is in blue.

In this commit, we change the color of the 'on hold' stage into 'info'
instead of 'muted'. After this projects that are 'on hold' are display
blue in the kanban progress bar as well.

Task-Id:2633273

closes odoo/odoo#78761

X-original-commit: 0886c10d5f276aca2539060ffaa047780a408354
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-10-21 15:47:14 +00:00
Aaron Bohy 9c5fecdf90 [FIX] web: ActionContainer: properly unbind handler
This isn't a problem in production, because the ActionContainer is
never destroyed, but it caused a small memory leak in the test
environment.

closes odoo/odoo#78698

X-original-commit: d01c89d80d58763e45309dbcfbf83f852866982e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-20 15:15:24 +00:00
Aaron Bohy 3feba2da91 [FIX] web: ui service: remove leak in tests
Before this commit, the ui service listened to the "change" event
on several MediaQueryList corresponding to specific window sizes.
However, those event handlers were never removed. Whereas this
isn't an issue in production (services are started once and live
forever), this caused a memory leak in tests, where services are
deployed on demand, test by test.

There is no cleanup function for services (since they live forever
by nature). In the test environment, we have a solution for handlers
bound on window (i.e. window.addEventListener), by monkey patching
the function (thanks to the browser object), and automatically
removing all handlers bound during a test, at the end of that test.

This commit fixes the memory leak by no longer using addEventListener
on MediaQueryList (as this is a deprecated feature anyway [1]), and
simply using window (or browser)'s addEventListener instead. This
leak sometimes produced a timeout in the QUnit test suite [2].

[1] https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener
[2] https://runbot.odoo.com/web#id=2374&action=573&model=runbot.build.error&view_type=form&cids=1&menu_id=405

X-original-commit: d86cc5c016cf4eff9a7e4f8b35a9ed38ddc24636
Part-of: odoo/odoo#78698
2021-10-20 15:15:24 +00:00
Aaron Bohy 7bd4ae9566 [FIX] web: prevent some tests from failing undeterministically
This is a tricky one. The problematic tests involve the quick edit
feature. Before this commit, those tests sometimes failed [1],
because there was no guarantee that we waited enough in the test
before doing assertions.

[1] https://runbot.odoo.com/web#id=2012&action=573&model=runbot.build.error&view_type=form&cids=1&menu_id=405

X-original-commit: 78762d0a0017e02f2df00d60140a2709fafaa0d5
Part-of: odoo/odoo#78698
2021-10-20 15:15:23 +00:00
Aaron Bohy 0c8b5c5da8 [FIX] web: attempt to fix non deterministic issue in tests
This commit *could* prevent a test from failing randomly. The
important part in the diff is the switch from $.Deferred to native
Promise. JQuery Deferred behave differently upon resolution (it is
sync if the deferred is resolved directly, whereas it is not the
case for native Promise). I couldn't find any other reason to
explain why the test was sometimes failing. There is no reason to
use Deferred anyway.

The issue didn't occur after this commit in more than 600 builds.

[1] https://runbot.odoo.com/web#id=2297&action=573&model=runbot.build.error&view_type=form&cids=1&menu_id=405

X-original-commit: ed0761dce44bd37cdd9d40ddd6e021517f466f97
Part-of: odoo/odoo#78698
2021-10-20 15:15:23 +00:00
Aaron Bohy b6ef017f64 [FIX] web: make test more robust
Before this commit, the changed test sometimes failed on runbot
(rarely though), because it might happen that the debounce released
before the promise returned by the click helper resolved (e.g. if
the server was overloaded, or was garbage collecting...). That
promise waited for a setTimeout, and then for a nextAnimationFrame.
In this scenario, there's no need to wait so long, as there is no
rendering to wait for.

Example of failing build: https://runbot.odoo.com/runbot/build/10360554

X-original-commit: 880c4683698c987f212e4a113b374230566001f1
Part-of: odoo/odoo#78698
2021-10-20 15:15:23 +00:00
Aaron Bohy f9594fba3f [FIX] web: patch: can call a not bound patched function
Before this commit, it wasn't possible to patch some functions
(e.g. setTimeout) on window, because of the way we call them.
Indeed, we typically do `setTimeout(...)`, because this function
doesn't need to be bound to the window object.

X-original-commit: 476dbf75bb88dc2ddfdd47c1f229ce53cf7fadb7
Part-of: odoo/odoo#78698
2021-10-20 15:15:22 +00:00
Bruno Boi 39777c9039 [FIX] web: always add usercontext to legacy action
In the new web client architecture, the user context is added to server
requests through the ORM service and is therefore not needed in the
action context. Thus the commit 7354d16 has removed it from the action.

Before the new webclient architecture, the user context was always
prepended to the action context. So this commit reintroduces it for
the legacy views and client actions through their proper adapters.

closes odoo/odoo#78685

X-original-commit: 7975674166a3d8fa9cd8714adab769a7fd681368
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Bruno Boi <brboi@users.noreply.github.com>
2021-10-20 11:44:58 +00:00
Bruno Boi 8687a220b7 [FIX] web: do not keep additional context in stored action
Before this commit
The current action is stored in the session storage with its evaluated
context. This design is wrong because a context is by definition
contextual which means it has to be evaluated at the last possible
moment to ensure it reflects the most recent context.

After this commit
The current action is now stored in the session storage it its most
original state. This is sufficient as in any case actions go through
the doAction method which evaluates the context right before applying
the action logic.

X-original-commit: 2533d47a1d312907389fb85af83f8812c402a609
Part-of: odoo/odoo#78685
2021-10-20 11:44:58 +00:00
std-odoo a7618b96ec [FIX] web: do not write before saving when clicking on a radio
Bug
===
If we open a view in readonly mode, click on a radio widget and if a
constraint exists on this field, an error message is raised.
(e.g. the enroll field in "website_slides_sale").

Technical
=========
This is because in the "Basic controller", in the "_onFieldChanged",
we force "force_save" if the view is in readonly mode. This is wanted
for widgets that can change the value even in readonly mode
(e.g. Priority), but clicking on a Radio widget switch the mode to edit,
so this is not needed.

To fix that, we call `setValue` after switching to the edit mode. So
the `setValue` is skipped in `_onInputClick` if we are in readonly mode,
and the `setValue` is done in `_quickEdit` instead.

Task-2668763

closes odoo/odoo#78684

X-original-commit: ff1329ca86691dd5f042158de6913c4aa2c69b6c
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-10-20 11:44:52 +00:00
Ivàn Todorovich bdd1f2062b [FIX] web: restore proper alignment and spacing of navbar's user avatar
closes odoo/odoo#78673

X-original-commit: 1dc91c2b22c5b99f48d692ec284ae39700fa2739
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-20 09:12:33 +00:00
Géry Debongnie 04ab67f1d2 [IMP] web: update owl from 1.4.6 to 1.4.7
Release notes:
https://github.com/odoo/owl/releases/tag/v1.4.7

closes odoo/odoo#78661

Fix: memory leak in some templates
X-original-commit: b1cb78169201159a0f103e6e41bb6d9ba99b074c
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-10-19 18:35:41 +00:00
Achraf (abz) f04ce9a516 [FIX] web: don't prevent DropdownItem click event if no href
Before this commit
Each click event triggered inside a DropdownItem is default prevented

After this commit
Those click events will be default prevented only when the DropdownItem receives a props.href, which will turn it into an <a href/> element.
This corresponds to the initial intention: prevent the default click behavior of an <a href/> element and only keep the DropdownItem click behavior.

opw-2665795

closes odoo/odoo#78628

X-original-commit: 11760db91fc56fb8b998d77661f8d4d7842f3eb8
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2021-10-19 14:43:50 +00:00
Barad Mahendra 281b65a943 [FIX] web,*_*: fix the html content in notification
Currently markup-ification of the legacy notifications system
display the html content in notification layout for some of the
notification of document and planning from commit: https://github.com/odoo/enterprise/commit/ba44461fea337ed2e5adbdfa1e8eede00b036def

So here in this commit, we make the method `makeLegacyNotificationService`
always `_.escape(message)` and pass `messageIsHtml: true` to the owl
notifications system so notification with html content will be displayed
properly.

Task-2657391

closes odoo/odoo#78627

X-original-commit: 7ce6d8d70be79c9c626865598b898dce9a18b045
Related: odoo/enterprise#21782
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-10-19 14:43:42 +00:00
Nicolas Lempereur ca3267baef [FIX] web: translate apply/cancel daterange widget
There was a missing translation for apply/cancel button in
daterangepicker widget. With this change, we provide the odoo
translation to the library when initializing the picker.

opw-2628117

closes odoo/odoo#78588

X-original-commit: 40f128baba53ce29c2d03b7370e54b5010edb9ef
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-10-19 10:51:10 +00:00
Mohammed Shekha 6087787cd3 [IMP] web: add percentage information in pie tooltip
With this commit, we add percentage information in pie chart tooltip,
A pie chart is meant to illustrate numerical proportions.
In Odoo, when hovering a piece of a pie chart, the tooltip is currently not
displayed the proportion/percentage of the piece in the pie. The purpose of
this commit is to provide the user with the percentages of data distribution by
adding them in the tooltip.
In the tooltip displayed when hovering a piece of the pie chart, add the
percentage between brackets.

task-2608695

closes odoo/odoo#78343

X-original-commit: f73bd6dad71045d9f0a012259f148f0c768b964b
Signed-off-by: FrancoisGe <fge@odoo.com>
2021-10-19 08:22:44 +00:00
Aaron Bohy 798bdcc645 [FIX] web: clickbot: correctly test filters
Since commit [1], the filters were no longer tested by the clickbot
because the DOM of the filter menu changed, and the clickbot
selector hadn't been adapted.

[1] https://github.com/odoo/odoo/commit/84715436d87bb05b421bc9ccaacda67d07571690

closes odoo/odoo#78494

X-original-commit: 54d313e5ce708cf0420aaa2529fa3f32f281205e
Related: odoo/enterprise#21735
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-10-15 20:58:06 +00:00
Prakash Prajapati 31943bc6ac [FIX] web: fix the unavailabilities day in calendar view
Currently, if there is unavailabilities day then white background and
border appear in calendar month mode. It does not show the same background.
Now the same background(grey) will appear.

closes odoo/odoo#78240
task-2648148

closes odoo/odoo#78444

X-original-commit: 64f2acc79d39331f79f3ac68d451f638cbd93393
Related: odoo/enterprise#21720
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-10-15 16:13:57 +00:00
Bruno Boi cc3403ad47 [FIX] web: action context pollution from session storage
Before this commit
An action retrieved from the session storage may not take into account
changes in the user context because the user context is duplicated in
the action context. When the user context changes i.e. through the
switch company menu (allowed_company_ids) and the browser reloads,
the action service will make the action context concatening the new user
context with the context of the action stored in the session storage,
which has still values from the previous user context.

After this commit
The makeContext function can now take an initial evaluation context.
This is then used in the action service in order to make use of the user
context when the action context is generated but without appending
it into the action one.

closes odoo/odoo#78415

X-original-commit: 7354d1686915ec21437fc677f15a6c5409106492
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-10-14 18:15:13 +00:00
Mohammed Shekha 683f29add1 [FIX] web: No results to show item was not displayed in m2o
before this commit: when m2o has can_create=false and user try to search
something that doesn't exist then it should show 'No results to show' in m2o
autocomplete, because of commit: https://github.com/odoo/odoo/commit/4f116a0f9be26b91d95e019cda1aa620faf6d620
this has been broken.

after this commit: if user can not create m2o record and if user searches that
doesn't exist in m2o model then it will display 'No results to show'

task-2376435

closes odoo/odoo#78329

X-original-commit: a9e14acc3785c972bd037a8d4ca303c10dad265a
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2021-10-14 11:16:47 +00:00
Martin Trigaux aa85e610dd [FIX] web: translate search_pannel options
Before this commit, the list of categories on the left, in the
ir.module.module kanban view, was untranslated

X-original-commit: d5feb987c523a3e188e87c181fe5aed7d03fabe3
Part-of: odoo/odoo#78259
2021-10-14 09:28:04 +00:00
Romeo Fragomeli 945ffb2d25 [FIX] web: avoid bad positioning for BlockUI on mobile
On mobile, since the commit [1], the BlockUI is not aligned with the
viewport due to its absolute position.

This commit restores the previous value ("fixed").

Steps to reproduce:
* Open Odoo
* Go to Apps
* Scroll a bit the page
* Install one App => BUG

Ref:
[1] odoo/odoo@0573acae23

closes odoo/odoo#78344

X-original-commit: 04db62a45f42aba72da7d36b94b3c5d03db37e20
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2021-10-13 19:32:33 +00:00
Bruno Boi b710b6d323 [FIX] web: missing test for usePosition hook
The commit a27bbda37f1ad4 did not add a unit test.

Here it is.

closes odoo/odoo#78297

X-original-commit: e3a32191b6b9411abaf4c15550e537c666d615bd
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-13 12:31:02 +00:00
Bruno Boi e8bbc5cd44 [FIX] web: pivot style in right-to-left
Headers of columns and rows are not properly aligned on RTL direction.

After this commit, they will be.

closes odoo/odoo#78261

X-original-commit: 2fb992d3ced438fd012d7702bdfbe23cce6000a6
Related: odoo/enterprise#21645
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-10-13 06:03:58 +00:00
Bruno BoiandSam Degueldre 3594b8cebd [FIX] web: fix crash when dropdown is unmounted quickly
Previously, when quickly mounting then unmounting a dropdown, a
traceback was shown. This is because the usePosition hook registered
listeners that were throttled/debounced, which would be called after the
component was already unmounted, causing the crash.

This commit fixes that by making cancelable the debounce timing util
and by introducing a new cancelable timing util: throttleForAnimation.
`debounce` and `throttleForAnimation` could be canceled i.e. when
a component is unmounted.

`throttleForAnimation` is used to replace throttle to avoid the popper's
scroll position not staying perfectly in sync with the page but instead
being slightly jittery, it effectively throttles a given function to the
display's refresh rate.

Also, the `throttle` util is kept unmodified but marked as deprecated.
Its implementation does not properly match its name, and we chose
to leave it as is because some code might already use it.

X-original-commit: a27bbda37f1ad444023cb1aae56675ac6c263cb2
Part-of: odoo/odoo#78261
Co-authored-by: Sam Degueldre <sad@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
2021-10-13 06:03:58 +00:00
Bruno Boi 44c6946c7c [FIX] web: dropdown menus should not overflow viewport
Before this commit:
Dropdowns menus were overriding the positioning hook direction flip
order in order to always stay in the same axis.
But a dropdown menu has as its maximum height 70% of the viewport.
These two "rules" aren't enough to ensure the whole spectrum of
possibilities will always make the menus entirely visible on screen.
We could have chose a correctier formula (50vh - toggler height), but
this would have led to sadly short dropdown menus in many cases,
so we chose the following alternative...

After this commit:
Dropdown components are no longer overriding the positioning hook
direction flipping order option.
That way, the flipping axis is no longer enforced and therefore the
menus will have a greater spectrum of possibilities to reposition.
This has shown us that it fixes the visibility issue of the menus.
E.g. when the menu flips to a right-middle position it could take up to
100vh and still get displayed entirely.

The position hook directionFlipOrder option has also been made
unavailable as there is no use case anymore.

X-original-commit: b768d771018843d7bfa8aab2e1b2e624d088e3f6
Part-of: odoo/odoo#78261
2021-10-13 06:03:58 +00:00
Bruno Boi 9c0d5228d4 [REV] web: reintroduce mobile dropdown positioning
Revert "[FIX] web: dropdown: avoid positioning in mobile"
This reverts commit 1271ef80fafa4438271af0919dcca229aa20bf81.

Revert Reason:
A better alternative fix to the original
issue has been found. See preceding commit.

X-original-commit: 384169fb1b5874fd670f07fb2a6b1aca449f56c9
Part-of: odoo/odoo#78261
2021-10-13 06:03:57 +00:00
Bruno Boi 97f90b03cf [FIX] web: usePosition computations on small screens
To compute a positioning, the usePosition hook uses as the default container
the <html/> element... but in the positioning computations it is assumed
that the container is scrollable which is not the case for small screens
when web_enterprise module is installed, as its webclient_layout.scss
applies rules to make sure only the main content is scrollable.

When the <html/> element is not scrollable, it can be scrolled out of the
viewport, which is problematic as the positioning computations are based
on a fixed positionment strategy.

The way we chose to fix this is to account the scrollTop position of the
container only if the container is the <html/> node.
If so, further computations will now take into account the amount of
scrolling the <html/> node has, and thus will be correct.

See https://developer.mozilla.org/docs/Web/API/Element/scrollTop fur
further understanding.

X-original-commit: a050094cdaa5dd6b76c3f10fb49d3a9c0813425a
Part-of: odoo/odoo#78261
2021-10-13 06:03:57 +00:00
Bruno Boi 2bd8bb4d7b [FIX] web: align pivot row groupby menus to right
The row groupby menus are always aligned on the left, but when a
multiple levels of groupby has been selected, it feels weird and
counterintuitive to see them aligned on the left whereas the row
labels are right aligned.

This commit makes sure that the alignment is coherent between the menu
and the row labels.

X-original-commit: b11b760365c45409b8ea10dee2a58c2e677e9d61
Part-of: odoo/odoo#78261
2021-10-13 06:03:57 +00:00
Sébastien Mottet (oms) e67463fbf1 [FIX] web: use full width for the onboarding banner
The owl OnboardingBanner component should be full width.

closes odoo/odoo#78228

X-original-commit: 3a0552a3a4e42bed8580715f097fad15f3e1e59f
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-12 12:57:04 +00:00