Commit Graph
12878 Commits
Author SHA1 Message Date
Benjamin Vray e1948a4865 [FIX] web, website: fix scroll to top with standard header effect
Before this commit, when clicking on a link with the standard header as
anchor (e.g. Enable "scroll to top button" option to the footer in edit
mode). The scroll animation stopped before reaching the top.

This happened because we stop the scroll animation when the scrollTop no
longer changes. This is the case during the standard header transition
animation. It is only at the end of the transition that we can know that
there has been a change of scrollTop. So this commit makes sure to wait
for the end of the transition to check the scrollTop position.

This commit also adds a "z-index" on the footer "scroll-to-top" button
to place it on top of the elements around it. Before that, the entire
button area was not clickable because it was partly covered by the
elements around it.

task-2773973

closes odoo/odoo#96067

X-original-commit: 201298c66d86c27c1ee05489ccf5c70da88b7e14
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-07-15 14:22:23 +02:00
Benjamin Vray 88e2297a6e [FIX] web: fix scroll to affixed header not fluid
This commit improves the smoothness of the scroll animation to an
affixed header.

As in this case, we stop and continue the animation several times in the
"scrollTo" function, we need to force the easing of the animation to
"linear" when the scroll animation is restarted in the "progress" of
"animate".

task-2773973

X-original-commit: 1770f61ebd9ebd0991ee13a93f0e771c9c0ad698
Part-of: odoo/odoo#96067
2022-07-15 14:22:23 +02:00
abd-msyukyu-odoo 40dda26350 [FIX] core, web: handle read_group ranges for multiple granularities
There was an issue with the computed `read_group` `__range` when grouping on
the same date/datetime field on multiple granularities (i.e. month, week).
Since the range was stored with the field_name as a key, the last evaluated
range would override the previous ones.

Impacted Versions:

  - master
  (- exists since 15.0 but it does not impact the user directly so it has been
  decided to fix this only in master, since the API is modified)

Steps to reproduce:

  1. Open a list view and group by a date field with at least 2 granularities
  2. Open the chrome debugger (network) and check a web_read_group rpc preview
  3. Find the web_read_group for groups related to one of the largest
     granularities and check the `__range`

Current behavior:

  - `__range = {field_name: false}`

Expected behavior:

  - `__range = {field_name: {from: range_start, to: range_end}`

Explanation

Since the smaller granularities are evaluated last, and the condition to update
`__range` is related to the field_name and not the granularity, the range is
always overriden by the smaller granularities (even if their value is False)
when grouping on the same field with multiple granularities.

Furthermore, there is a conceptual problem with the current solution: it does
not allow to store multiple ranges when the read_group is not lazy and when
grouping on the same field with multiple granularities.

Therefore, the proposed solution is to use the full groupby keys in the
`__range` to allow storing multiple ranges depending on granularity. The keys
in `__range` would thus match the group value keys and allow more flexibility
if a domain must be forged from the group(s) range(s).

Task-2894519

closes odoo/odoo#95193

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-07-14 18:03:50 +02:00
abd-msyukyu-odoo 74753681ee [FIX] web: fix dragging a nest in article tree
When dragging an article with an open nest, the `jquery.mjs.nestedSortable`
library does not refresh the positions of the following articles. This forces
the user to drag the nest far below the target position to move the placeholder.

This commit is a small fix to the library, to refresh said positions before
checking for element intersection.

Task-2883290

closes odoo/odoo#95749

Related: odoo/enterprise#29315
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-07-14 16:42:01 +02:00
abd-msyukyu-odoo 4272e239de [FIX] web: prevent flickering when moving an article down
Prevent a flickering effect when dragging item down in a nested tree using the
`jquery.mjs.nestedSortable` library.

Situation:

1.) start dragging, moving down and slightly to the left

.dragged item
.nest0
  .nest00
    .nest000

2.) intersect nest0

.nest0:hover:.dragged item
  .nest00
    .nest000
.drop destination

3.1.LIBRARY) intersect nest00 first trigger

.nest0
  .nest00:hover:.dragged item
    .nest000
  .drop destination (frame 1)

3.2.LIBRARY) intersect nest00 second trigger (slightly below and to the left)

.nest0
  .nest00:hover:.dragged item
    .nest000
.drop destination (frame 2)

frame 1 and frame 2 are rendered almost simultaneously, and in a cycle (after
3.2. comes 3.1. again), resulting in a flickering effect.

3.1.FIXED) intersect nest00

.nest0
  .nest00:hover:.dragged item
    .nest000
.drop destination

drop destination is not allowed to go UP in the dom since the mouse is lower
than before. No flickering in this case.

To go up in the tree, the user can simply move the cursor to the right and/or
up.

The `jquery.mjs.nestedSortable` library will be rewritten internally in the
future to remove the jQuery dependency, but this fix allows a smooth utilisation
in the meantime.

Task-2883290

Part-of: odoo/odoo#95749
2022-07-14 16:42:01 +02:00
Matthieu Stockbauer 3ae11c87e8 [IMP] mail, *: adapt bus service to wowl env.
*: bus, calendar, iap_mail, im_livechat, project, web.

In order to ease the PR introducing the websockets in Odoo, the bus service
has to be updated to be a wowl service. This PR takes care of it.

task-2053917

closes odoo/odoo#95824

Related: odoo/enterprise#29361
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-07-14 11:42:42 +02:00
Romeo Fragomeli 96835942cc [FIX] web: adapt form layout for database manager
Adapt forms for BS5

closes odoo/odoo#95934

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-07-14 10:22:48 +02:00
Michael (mcm) 2faf0ac64d [FIX] web: fallback for domain selector operator
Before this commit, it happened that the domain selector
couldn't find the operator linked to the field.
This commit adds a fallback on the existing operators
to find an operator that matches.

for example the domain `[["name", "like", "M"]]` gave
`Name ? "M"`, now it correctly gives `Name like "M"`.

closes odoo/odoo#95891

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-13 18:49:50 +02:00
Michael (mcm) da8f1d44c9 [IMP] web: add in_dialog option to domain field
In legacy, the domain field had an `in_dialog` option that was
used to display a button that opens a dialog to edit the value.
This commit reimplements the `DomainSelectorDialog` in owl
and adds the option the new domain field.

closes odoo/odoo#95768

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-13 17:40:57 +02:00
Michael (mcm) 88412a2d2b [FIX] web: fix patch descriptor
Before this commit, patching a getter of a class made it enumerable
(`Object.keys({ a: 1 })` -> `["a"]`).
In javascript, getters of a class are not enumerable but
getters of an object are enumerable.

When patching, the system replaced the descriptor of the old class
member by the member of the object.
Now, it replaces some info of the old descriptor by the new descriptor
but not the entire descriptor.

closes odoo/odoo#95921

X-original-commit: fd7c2c0c14bfaac228abacb265278157eec4aad0
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2022-07-13 16:23:08 +02:00
FrancoisGe 1f4e583ba2 [FIX] web: CP lose init seach value
Before this commit, in the HomeMenu, typing several characters very
quickly could result in some not being present in the command palette
when it was opened.

Exemple:
In the HomeMenu,if I type "a" "b" "c" quickly the command palette will
open with the search value "/a" or "/ac". So we have lost the second
and/or third character.

Why:
All characters typed between the first and the moment the command pallet
is not yet mounted are lost because the search bar of the command pallet
is not yet available.

Solution:
If you use openPalette and the command palette is already open.
The configuration of the command pallet will be overwritten by the one
given to openPalette.
In our case, we can pass new configurations with the correct searchValue
until the command palette is returned.

closes odoo/odoo#95492

Task-id: 2906623
Related: odoo/enterprise#29230
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-07-12 04:21:33 +02:00
Romeo Fragomeli 12e189bb48 [FIX] web: BS5: restore table-striped behaviour
In BS4 text color wasn't defined for `table-striped`.
In BS5 color text decorations in list views was broken because of BS5
sets the color of all `td` in a stripped table.
Now we simply override the value of the variable to inherit.

closes odoo/odoo#95746

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-07-11 20:25:20 +02:00
Mathieu Duckerts-Antoine f76205322e [FIX] web: graph,pivot: favorite groupbys
Problem:

Have a pivot view in some state. Toggle a favorite with a context in
which a key "pivot_row_groupby" is defined. The pivot view should be
grouped (on rows) by that pivot_row_groupby but it is not always the
case. The basic problem is that the key "pivot_row_groupby" is never
considered after the first load (see method load in pivot_model.js).

Solution:

We make the search model used by the pivot view send as groupby for the
favorite its pivot_row_groupby instead of its groupBy (which can be
different). We do something similar for the graph view that presents a
similar problem.

closes odoo/odoo#95688

Opw: 2837428
X-original-commit: ea9f66f99caaa6136912c467e5b80fe605586845
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-11 07:58:55 +02:00
Samuel Degueldre 5cc0672c10 [FIX] web: add missing selector for badge field in legacy views
The rule should apply to both the legacy badge field and the new badge
field, when adapting the css to the new badge field, the selector that
targets the legacy badge field was broken. This commit fixes that.

closes odoo/odoo#95665

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-07-08 19:52:55 +02:00
Romeo Fragomeli cf2d625a85 [FIX] mail,web: DiscussPublicView layout broken
Since BS5 migration [1], we added the possibility to customize the
BS utilities classes using Bootstrap API [2].

But in the mail module files was not added in the
`mail.assets_discuss_public` bundle so no utility class was generated.

Also, missing 'text-black' and 'text-white' are now added in the
compiled SCSS (for `mail.assets_discuss_public` bundle).

Refs:
[1] odoo/odoo#95450
[2] https://getbootstrap.com/docs/5.1/utilities/api/

closes odoo/odoo#95661

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-07-08 19:52:52 +02:00
Adrien Dieudonne d5bf4ca473 [FIX] web, hw_drivers: bootstrap: removes js bundled Bootstrap file
Some modules used Bootstrap minified bundle but this was replaced
in [1] to avoid using of minified files.

We now want to have the same way to import bootstrap by using non-minified
individually compiled Bootstrap files (bootstrap/js/dist/).

Note that in 'hw_drivers', the js and css part was imported at the
same time but the javascript seems never used...

REF:
[1] https://github.com/odoo/odoo/pull/95450

Part-of: odoo/odoo#95628
2022-07-08 17:10:47 +02:00
Adrien Dieudonne 9d0bf51458 [IMP] web: bootstrap: remove source files
Sources files (boostrap/js/src/) are not used in Odoo.
We actually use:
- All at once compiled code (bootstrap/dist/)
  -> only for /hw_drivers (POS) and /web (database_manager)
- Individually compiled Bootstrap (bootstrap/js/dist/)

REF:
https://github.com/odoo/odoo/pull/95450
https://getbootstrap.com/docs/5.1/getting-started/contents/
https://getbootstrap.com/docs/5.1/getting-started/javascript/

Part-of: odoo/odoo#95628
2022-07-08 17:10:47 +02:00
Jorge Pinna Puissant 2a44537c7c [FIX] web: missing class on monetary field
Before this commit, a class was missing when the monetary field was on
edit mode. This results in a non-alignment between the monetary symbol
and the value.

closes odoo/odoo#95620

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-08 14:34:16 +02:00
Michael (mcm) d85609501d [REF] web: change field.extractProps API
Before this commit, the record was given to `field.extractProps`
so it could return props based on the record.
Now, only the attrs and field is given so it can be called
only once when parsing the arch (except for kanban).

closes odoo/odoo#95389

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-08 14:33:52 +02:00
Jorge Pinna Puissant cd9ba6b06a [FIX] web: take into account orientation classes on radio button field
Before this commit, all radio buttons were on horizontal style,
the o_vertical class was not taken into account.

closes odoo/odoo#95553

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-08 13:21:53 +02:00
Xavier BOL (xbo) 45780793dd [FIX] web: create string ast for PyDate(time) object
Before this commit, when a new domain is created with a list of rules
and in one of those rules contains a PyDate/PyDatetime object in a
right leaf, this leaf will be converted into a plain object instead of
keeping the initial object.
For instance:
```js
a = new Domain([['date', '=', PyDate.create({day: 1, month: 1, year: 1970})]])
a.toList() // result: `[['date', '=', {day: 1, month: 1, year: 1970}]]`
```
Since it is a plain object, when the result will be passed to the
server, the final result will be an object in a string instead of giving
the utc date formatted.

This commit fixes this issue by checking if the object instances of the
`PyDate` or `PyDatetime`. If it is the case, then the ast type will be a
string and the value will stay the same instead of creating a plain
object and the ast type which determines a JSON.

closes odoo/odoo#95570

X-original-commit: be5c8d0fc340b3e2ad9721d21ef1133870d8a774
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Xavier <xbo@odoo.com>
2022-07-07 17:31:19 +02:00
Mathieu Duckerts-Antoine c59eac2fcb [FIX] web: kanban: dragged record cannot be saved
In a grouped kanban view, drag a record to another column can modify the
record validity. In that case, the group changes should not be validated
and the drag and drop canceled.

closes odoo/odoo#95437

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-07 14:44:14 +02:00
Mathieu Duckerts-Antoine a32aae21be [REF] web: kanban: less (in try) is better
We rewrite a bit the method moveRecord of KanbanDynamicGroupList in
order to have less code in a try/catch.

Part-of: odoo/odoo#95437
2022-07-07 14:44:14 +02:00
Romeo Fragomeli 1fcd098af5 [REF] *: BS5: migration
Automated change made by a lot of RegEx to change all think that is
possible to automate.

https://getbootstrap.com/docs/5.1/migration

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
Romeo Fragomeli 9b5c9484fe [REF] *: BS5: adapt changes in media query mixin
> Media query mixins parameters have changed for a more logical approach

> media-breakpoint-down() uses the breakpoint itself instead of the next
> breakpoint (e.g., media-breakpoint-down(lg) instead of
> media-breakpoint-down(md) targets viewports smaller than lg).
> Similarly, the second parameter in media-breakpoint-between() also
> uses the breakpoint itself instead of the next breakpoint (e.g.,
> media-between(sm, lg) instead of media-breakpoint-between(sm, md)
> targets viewports between sm and lg).

https://getbootstrap.com/docs/5.1/migration/#sass

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
Adrien Dieudonne 2bc60ad9bd [FIX] web: bootstrap: unwanted triggerTransitionEnd
There is a timeout that force the call to the transitionEnd
to prevent some issue [1]. '_cleanTipClass' callback was then
executed who call getTipElement.
It seems that the tip doesn't exists but the JS is still alive.
After that a crash occurs in [2]: _config is null.

Maybe jQuery was more permissive/defensive before BS5 and this error
was avoided.

So, we had this non-deterministic error:
> UncaughtTypeError: Cannot read properties of null (reading 'template')
Especially in 'test_17_website_edit_menus' with tooltip/popover.

Now we avoid the error in complete by checking if there is an element or
_config not null.

Ref:
[1] https://github.com/twbs/bootstrap/pull/33845/files
[2] https://github.com/twbs/bootstrap/blob/v5.1.3/js/dist/tooltip.js#L630
https://stackoverflow.com/questions/69766375/typeerror-cannot-read-properties-of-null-reading-template-on-bootstrap-tool
https://github.com/twbs/bootstrap/issues/25519

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
Romeo Fragomeli c741f6e48c [REF] web: add responsive width/height classes utilities
This allows media queries in width/height classes.
This behavior was supported in BS4 but has been deleted in BS5.

e.g. w-md-75 (in Leaderboard eLearning)

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
Romeo Fragomeli f68329346f [REF] web: BS5: merge rounded using Bootstrap utilities API
To avoid redundancy and mess rules with rounded classes we simplify
all rules in one location (before was in web and web_enterprise)

Also, we don't set the $rounded variables to 0, so we can use it in
the Bootstrap utilities API. Instead, we have set to 0 the specific
variables.

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:23 +02:00
Romeo Fragomeli 9cfb3270a4 [FIX] *: wrong usage of media-breakpoint-between
It seems louche to use media-breakpoint-between(lg, xl,
$o-extra-grid-breakpoints) as in $o-extra-grid-breakpoints there is an
XXL value.
In short, in XXL mode the padding fallback to the value outside the
breakpoint (twice smaller).

e.g. result in CSS
```css

.o_form_view .o_form_sheet_bg > .o_form_sheet {
  padding-right: 16px;
  padding-left: 16px;
}

@media (min-width: 992px) and (max-width: 1533.98px) {
  .o_form_view .o_form_sheet_bg > .o_form_sheet {
    padding-right: 32px;
  }
}

@media (min-width: 992px) and (max-width: 1533.98px) {
  .o_form_view .o_form_sheet_bg > .o_form_sheet {
    padding-left: 32px;
  }
}
```

Part-of: odoo/odoo#95450
2022-07-07 13:30:23 +02:00
Romeo Fragomeli a10d6bb9eb [REF] *: BS5: use text-bg-#{$color} to keep the contrasted text color
In BS5 `bg-#{$color}` don't set the color of the text. So in some case
the color is not the right one.

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:22 +02:00
Romeo Fragomeli e94bd1d978 [REF] *: BS5: remove already existing behavior in BS5
- removes handle for tab as already done in BS5

- remove the `border` image attribute to restore the BS4 behaviour
  In the FieldBinaryImage and FieldBinarySignature widget there is the
  `border` attribute to force the image to have a border.
  But in the actual environment it's useless as Bootstrap 4 remove de
  border of all image by default, so the rules is useless.
  But in BS5 this rules was removed so in some place some image as the
  border set.

In BS4:
```css
img {
    border-style: none;
}
```

e.g. where there is the case:
Helpdesk > Reporting > Customer Ratings (Kanban card)

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:22 +02:00
Romeo Fragomeli fe4f1efb70 [REF] *: BS5: Restore BS4 behaviour
- new prefix `bs-` for the root CSS variables
As some website snippet relay on these values we need to restore the old
behaviour by setting this prefix to an empty string.

- restore negative margins disabled in BS5 by default

- restore BS4 behaviour for setting element content
  Fix some cases when we want to render more than one node on the root
  level.
  In BS4 the jQuery was using all node but in the jQuery compatibility
  layer in BS5 it takes only the first node if the jQuery Element is used
  in the function. This hack try to restore the old behaviour wrapping all
  element in a DIV element (to be single root node).
  PS: this can break some querySelector and some CSS selector if they are
  too fragile.
  e.g. of element that break before this hack:
  Popover content for PaymentPopOver XML in ShowPaymentLineWidget

- restore old value from BS4 and adapt to new value
  $table-cell-padding -> $table-cell-padding-x
  $table-cell-padding -> $table-cell-padding-y
  $table-cell-padding-sm -> $table-cell-padding-x-sm
  $table-cell-padding-sm -> $table-cell-padding-y-sm

- restore BS4 smooth-scroll behaviour

- restore `text-X` from BS4 that use text-emphasis-variant
  In BS5, to generate the text utilities `test-X` its use BS5 utilities
  (See $utilities SCSS variables). To restore the old behaviour we replace
  with the custom `text-emphasis-variant` mixin.
  See odoo/odoo@e111cfd35e

- restore border and background of table
  In `_reboot.scss`, BS5 add `border-style` to all element of a table.
  In some case we customize the table with CSS rules (e.g. `listview`),
  these rules set a size of border. The mix of all rules made that the
  border of the `td` in `tfoot` are visible and make a black line.

- reset block quote Y margin to 0
 BS5 add a spacer and we reset that by puttin margin-y 0

- In BS5, border color is linked to the text color in it. We doesn't
want that and we restore the same behavior as un BS4 by putting
border-color in grey.

- restore HR style like in BS4
  Since in BS5, the height matter we remove the padding and added into the
  margin.
  Also, we restore the color of BS4 for the HR tag

> <hr> elements now use height instead of border to better support the
> size attribute. This also enables use of padding utilities to create
> thicker dividers (e.g., <hr class="py-1">).

https://getbootstrap.com/docs/5.1/migration/#content-reboot-etc

- restore old value for grid gutter to avoid calc error
  In BS5 `$grid-gutter-width` is set in rem and in BS4 it was in px.
  So SCSS compiler generates error when it tries to calc rem and px.

- restore badge, navbar paddings like in BS4

- restore link decoration in frontend (Portal) whiteout website

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:21 +02:00
Romeo Fragomeli 3e7c13c97d [REF] *: BS5: Migrate data attributes
> Data attributes for all JavaScript plugins are now namespaced to help
> distinguish Bootstrap functionality from third parties and your own code.
> For example, we use data-bs-toggle instead of data-toggle.

https://getbootstrap.com/docs/5.1/migration/#javascript

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:21 +02:00
Romeo Fragomeli 596e5a471b [FIX] web: Database Selector: for attribute misused
Part-of: odoo/odoo#95450
2022-07-07 13:30:21 +02:00
Romeo Fragomeli d914c10dc9 [REF] web: BS5: adapt Database Selector
https://getbootstrap.com/docs/5.1/migration

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:21 +02:00
Romeo Fragomeli 4477e946a0 [REF] web: BS5: forward port sr-only for TempusDominus
TempusDominus is using sr-only but in Bootstrap 5 it was renamed in
visually-hidden. So we "forward port" it to avoid patching the lib.

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:20 +02:00
Romeo Fragomeli f936513466 [REF] *: BS5: avoid multiple usage of BS handler
In BS5 there is a check to avoid having multiple handler for one
element and we can't add two components' instance on an element.

So, before disposing a tooltip we check if there is an instance of a
tooltip and we avoid instantiation of tooltip if not already done.

e.g.:
> Bootstrap doesn't allow more than one instance per element. Bound
> instance: bs.collapse.

e.g.:
> Bootstrap doesn't allow more than one instance per element. Bound
> instance: bs.carousel.

> Bootstrap doesn't allow more than one instance per element.
> Bound instance: bs.tooltip.

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:20 +02:00
Romeo Fragomeli 0b94da214b [REF] web,website: BS5: Convert JavaScript MonkeyPatch
Converted for new Javascript of Bootstrap 5.

Note: some parts are removed as not found equivalent function name in
BS5.

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:20 +02:00
Romeo Fragomeli e1ea58c941 [REF] *: BS5: Migrate dropdowns
- BS5 JS use the `data-bs-toggle="dropdown"` attribute to
automatically enable the BS Component.
But in this case as the `.dropdown-menu` is only rendered when the
`.dropdown-toggle` is clicked we can't initialize the Dropdown at the
first render. So we do it manually.

- change .dropdown-menu by .o-dropdown-menu (owl)
  -> to handle keyboard navigation we can't use BS dropdowns

- use currentTarget of event
  As the event can bubble we use currentTarget to be sure to be at the
  higher level in the DOM.

> All the events for the dropdown are now triggered on the dropdown
> toggle button and then bubbled up to the parent element.

- BS5 don't add .show on parent group anymore
  -> dropdown show class not on the same node on BS5

- avoid dropdown warning using margin in CSS
  BS5 show a warning if we use margin statically in CSS for a dropdown.

> Popper: CSS "margin" styles cannot be used to apply padding between
> the popper and its reference element or boundary. To replicate margin,
> use the `offset` modifier, as well as the `padding` option in the
> `preventOverflow` and `flip` modifiers.

- adapt the systray activity dropdown for mobile
  On desktop positions are now dynamic and on mobile it's static

- In BS5 the CSS `bottom: 100%;` is not more applied to the
  `.dropup .dropdown-menu` selector.

- Change right -> end and add data-bs-popper="none" to avoid
  Popper interaction

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:19 +02:00
Romeo Fragomeli 68a3bd651f [REF] *: BS5: Migrate tables
- avoid black border in table of BS5

In BS5 there is a new rule:
```css
.table > :not(:first-child) {
    border-top: 2px solid currentColor;
}
```
This rule generate unwanted border in our visual, so we change the color
to the old one we have in BS4 and in some case set the `border-top` to
´none´.

PS: another solution is to use the `table-borderless` class, but then
we have `tr` flickering for the height in list view (edit mode).

- table background-color :
  * BS4:
  the background color is set with the `background-color` property
  * BS5:
  it's set with a box shadow and the `--table-accent-bg` CSS variable

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:19 +02:00
Romeo Fragomeli 9ea1351334 [REF] *: BS5: Migrate forms and inputs
- BS5 uses native inputs instead of pseudo-element for some
  input like checkbox, radio, ...
  in BS5 input checkbox don't have "virtual visual" checkbox anymore
  (::before), so we remove the relative's rules

- removed `.custom-control` class

- `form-switch` use a new layout system in BS5 we adapt the code to
  match the Bootstrap approach (inline SVG).

- In tests, we don't check the exact value of the background as it
  change in community/enterprise, and it's difficult to check the value
  of an SVG.

- Overflow in progressbar is now hidden.
  -> we had to restore it.

- In BS5 margins in forms/inputs has been changed
  -> we had to restore it (e.g. 'mb-3')

- .form-group, .form-row, .form-inline
> Dropped form-specific layout classes for our grid system.
> Use our grid and utilities instead of .form-group, .form-row,
> or .form-inline.

- .input-group-append and .input-group-prepend
> Dropped .input-group-append and .input-group-prepend.
> You can now just add buttons and .input-group-text as direct
> children of the input groups.

Ref:
[1] https://getbootstrap.com/docs/5.1/migration/#forms

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:18 +02:00
Romeo Fragomeli b82ba2a8fd [REF] *: BS5: Migrate modals and .btn-close for modals and alerts
- modal 'show' option doesn't exist anymore
  -> We need to call .show()

- by default, show is not the default
  -> we need to call .show() explicitly.

- generic close button for dismissing content like modals and alerts.

- BS5 modals needs `modal-dialog` class to work

- normally we need also to add `modal-content` class but as the original
XML don't have this nested level of div we don't use it, but instead
we add `pointer-events: auto` for all children `DIV` of `modal-dialog`
-> See DocumentViewer

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:18 +02:00
Romeo Fragomeli ac584e171d [REF] *: BS5: Migrate Badge
From [1]:
> Dropped all .badge-* color classes for background utilities
> (e.g., use .bg-primary instead of .badge-primary).

We now have to manage constrast for some badge. It's why we
add 'text-dark' at some point.

Note:
Due to the backport of 'text-bg-#{theme}', we can use this to
avoid to use 'text-dark'.

Ref:
[1] https://getbootstrap.com/docs/5.1/migration/#badges

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:18 +02:00
Romeo Fragomeli 23facbfb76 [REF] *: BS5: migrate popovers/Tooltip
* data('bs.popover') is not a jQuery data anymore
  -> fetch data from the instance instead.

* use the new class name 'popover-arrow' instead of 'arrow'

* website_forum: offset is not a number anymore
  -> Convert to string instead.

* BS5 event listener: 'focus' -> 'focusin'

* use `mouseover` event to show and `mouseout` to hide.

* disable at some point the animation to avoid remaining listener
  in the DOM.

Ref:
https://getbootstrap.com/docs/5.1/migration/#popovers

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:17 +02:00
Romeo Fragomeli 19a0ee516f [REF] event, web: BS5: $emphasized-link-hover-darken-percentage -> $link-shade-percentage
In BS5 `$emphasized-link-hover-darken-percentage` was removed, so we use
the new variable but we restore some BS4 values:

- 15% as in BS4
- remove the underline on links as in BS4

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:17 +02:00
Romeo Fragomeli 9f556638ab [REF] web: BS5: $custom-control-gutter -> map-get($gutters, 2)
BS5 introduce gutter utilities, and so remove old SCSS variable to use
the new one.

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:17 +02:00
Romeo FragomeliandStefano Rigano 41eebf822b [REF] *: BS5: handle contrast color
The logic not identical in BS4 -> BS5
The color contrast system in BS5 relies on WCAG 2.0 contrast algo.
So color-yiq is converted to color-contrast.
Note that there are some "texts/buttons/other visuals" elements
which will not have the same contrast as before.

$yiq-text-dark and $yiq-text-light are respectively replaced with
$color-contrast-dark and $color-contrast-light.

Note that we had to use '$min-contrast-ratio: 2.2' for .o_tag_color_X badge.

Task ID: 2766483

Part-of: odoo/odoo#95450
Co-authored-by: Stefano Rigano <sri@odoo.com>
2022-07-07 13:30:17 +02:00
Romeo Fragomeli 42d546a902 [REF] web: BS5: adapt opacity-X-hover classes to class utilities
This can be done by using BS5 API.

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:16 +02:00
Romeo Fragomeli 3c4ffd1c89 [REF] *: BS5: remove hover mixins usage (due to BS5 removal)
* = mail, survey, web, web_editor, website, website_event, website_mail

removed mixins:
* hover
* plain-hover-focus
* hover-focus

These mixins are now replaced by their CSS equivalent.

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:16 +02:00
Romeo Fragomeli fb3b9f96de [REF] *: BS5: handle color overrides
This commit is a hack for Bootstrap 5
In Bootstrap 4 these variables was used with map-merge()
In Bootstrap 5 these variables has set only if they don't exist before

PS: Another fix will be to reorder all bundle to follow Bootstrap
documentation and do another logic that wasn't use before.

Ref:
https://getbootstrap.com/docs/5.1/customize/sass/#colors

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:16 +02:00