Commit Graph
338 Commits
Author SHA1 Message Date
Bruno Boi 48511c148e [FIX] web: make a parse smart date test pass
- Name of the test
"utils > dates > parse smart date input"

- Before this commit
The test makes a comparison between the result of parse utils,
which yields luxon's DateTime objects in the user's local TZ
(patched by default to UTC+1 in the testing env), and locally
created DateTime objects in UTC.
This has no sense to compare a date in UTC with another in UTC+1.
The test was thus failing when ran between 11pm and 0am.

- After this commit
The test has been refactored.
Also, even if it has no impact on the parsing result, the local function
parseSmartDateInput now use a DateTime object in local TZ.
This has been done in order to avoid future confusion.
If you're wondering why it has no impact, it is because this function is
used in parseDate(Time), which always sets the local TZ at the end:
```
const a = {
  foo: luxon.DateTime.local(),
  bar: luxon.DateTime.utc(),
};
a.foo.equals(a.bar.setZone("default")); // true
```

closes odoo/odoo#99616

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-06 21:24:01 +02:00
Mathieu Duckerts-Antoine 5c4a54022b [FIX] web: rpc: not parsable request response
Connect in your browser to a db on runbot with mail installed and wait
until the runbot put to sleep the db. After a while, a new request to
get im_status will be sent and nginx responds to it with an error 404
and an invalid JSON response. A traceback with a particularly bad
message is then shown. Here we improve the traceback message.

closes odoo/odoo#99430

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-02 23:16:16 +02:00
luvi 87b21cd711 [FIX] web: cancel action on close of ConfirmationDialog
This commits fixes the behavior of the confirmation dialog.
When a user dismiss a dialog using the close button or the
ESCAPE key, it should expect to execute the cancel action,
if any had been given to the dialog.
The behavior was missing, and the dialog was simply closed.

Tests have also been added, since this core component didn't
have any test since its introduction.

closes odoo/odoo#99418

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-01 18:11:18 +02:00
Lucas Perais 7f4f19582b [FIX] web, barcodes: correctly handle chrome's autofill
On Chrome, have a field that supports autofill (you have to have set up an adress in Chrome first).
Click on that field, and apply the autofill proposition.

Before this commit, there was multiple crashes, roughly one for every handler of event `keydown`.
This was caused by the fact that the autofill feature triggers keydown events without the field `key`.
(https://bugs.chromium.org/p/chromium/issues/detail?id=581537, I could not find a better ticket).

This seems to be a bug on Chrome's side, since the spec doesn't mention that field may be unset (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).

After this commit, there is no crash.

closes odoo/odoo#99348

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2022-09-01 17:11:12 +02:00
Bruno BoiandJulien Mougenot 0f49724436 [IMP] web: simplify format/parse/deserialize date(time) utils
The goal is to improve the dates utility functions (parse/format) by removing the timezone option, which is difficult to understand and has proven to be error prone.

- Rationale
When manipulating DateTime objects on the JS side, associated timezones
must be always coherent.
Until now, there were several code parts that had to check the DateTime
timezone and handle things differently in a case or another.
This sometimes lead to wrong code.
E.g. there was a bug in the DatePicker component because the DateTime
object it receives in props is in local timezone, but once it updates it
through the parse utility, the new object is in UTC.

- After this commit
The DateTime objects you'll get through deserialization or parsing are
always set in the user's local timezone.
The formatted strings you'll get through formatDate and formatDateTime
utils will always be expressed in the user's local timezone.
The formatted strings you'll get through serialization utils will always
be expressed in UTC.

- serializeDate and serializeDateTime
  - expected input: a DateTime object (its timezone does not matter)
  - outputs: a string formatted for the server expressed in UTC

- formatDate and formatDateTime
  - expected input: a DateTime object (its timezone does not matter)
  - outputs: a string formatted for the user, expressed in the user's TZ

- deserializeDate and deserializeDateTime
  - expected input: a date(time) string provided by the server, in UTC
  - outputs: a DateTime object in user's TZ

- parseDate and parseDateTime
  - expected input: a date(time) string provided by the user, in its TZ
  - outputs: a DateTime object in user's TZ

- Other changes in this commit
As the timezone option has been removed from parsing/formatting utils,
all their usage had been adapted in the codebase.
The large diff in dates_tests.js is because some tests were reorganized,
others were removed/adapted/joined.
A test has been removed from daterange_field_tests.js, because it has
no sense: it displays a date field as a datetime, but a date field does
not have any time information.

Part-of: odoo/odoo#98980
Co-authored-by: Julien Mougenot <jum@odoo.com>
2022-09-01 17:10:59 +02:00
Mathieu Duckerts-Antoine 96b211cc4d [FIX] web: date picker inside a dropdown
Have a date picker component in a dropdown (like in Add Custom Filter),
open the related bootstrap datepicker by clicking on the date picker
input and select a date: the dropdown closes. In this fix, we make the
dropdown stay open in that situation.

closes odoo/odoo#99345

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2022-09-01 10:30:18 +02:00
Bruno Boi 0ae158bf43 [LINT] web
closes odoo/odoo#99295

Related: odoo/enterprise#30900
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-08-31 18:53:51 +02:00
Mathieu Duckerts-AntoineandMichael Mattiello 3498235ea0 [FIX] web: DomainSelector: set [(1, "=", 1)] in debug text area
Setting [(1, "=", 1)] as domain in the debug text area would make crash
the DomainSelector component because the sub component ModelFieldSelector
would not accept 1 as a fieldName prop due to its props validation. We
fix that by converting 1 to a string.

Part-of: odoo/odoo#99207
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
2022-08-31 12:37:51 +02:00
Aaron Bohy bedce02bb7 [REF] web,mail,account: orm service: move context in kwargs
This commit standardizes the API of orm service functions by adding
a "kwargs" parameter, s.t. one can always use those functions even
if the target model overrides the corresponding method to add the
support of a given kwargs. Furthermore, to simplify those function
API, and to close the gap between the js and python APIs, we moved
the "context" argument inside the kwargs.

closes odoo/odoo#99018

Related: odoo/enterprise#30830
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-08-30 20:23:17 +02:00
Aaron Bohy 002a76eaaa [IMP] web,account: orm service: allow to create in batch
This commit changes the API of the "create" function of the orm
service to better reflect the API of the corresponding method in
models.py, which takes a list of record values in argument.
Before this commit, a call to "create" only allowed to create a
single record.

Part-of: odoo/odoo#99018
2022-08-30 20:23:17 +02:00
Aaron Bohy 23101ed69a [FIX] web,mail: orm service: can pass kwargs to read
Before this commit, the "read" function of the ORM service didn't
allow to pass any kwargs. As a consequence, it wasn't possible to
call the "read" method of a model with "load" kwargs specified.
This commit fixes the issue, and adapts existing calls accordingly.

Part-of: odoo/odoo#99018
2022-08-30 20:23:16 +02:00
std-odoo a740989ba5 [MOV] web: move the domain selector component to web
Purpose
=======

For security reason access on ir.model is not granted to internal suers. Due
to this constraint a component exists in spreadsheet to be able to select
the models for which we have a read access on the records of this model.

This is required for the properties fields feature, hence moving its code
to web.

Some renaming is performed to make it generic. This generates some changes
in other addons, notably some class renaming.el.

Task-2852259

Part-of: odoo/odoo#95184
2022-08-29 23:46:07 +02:00
Julien Mougenot 1ab23b9467 [FIX] web: Prevent drag on kanban record dropdown
Before this commit, clicking on any part of a kanban record would
initiate a drag & drop sequence, this included its dropdown. This caused
2 issues:

- You could start to drag & drop records by dragging their still opened
dropdowns ;

- Said dropdowns would remain open when dragging their parent record.

This commit fixes both of these issues by hiding dropdowns during drag
sequences and preventing drag when clicking inside the dropdowns.

closes odoo/odoo#98791

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2022-08-25 12:05:15 +02:00
Julien Mougenot cf4a8f198f [IMP] web: Add 'ignore' param to useSortable
This commit adds a new parameter to the 'useSortable' hook that allows
HTML elements to prevent a drag sequence. This 'ignore' param can be a
string or a function returning a string, that will be a selector
targetting the elements that need to prevent drag & drop sequences.

Part-of: odoo/odoo#98791
2022-08-25 12:05:15 +02:00
Julien Mougenot de0d409efc [IMP] web: Add params to useAutofocus
This commit introduces an object parameter to the "useAutofocus" hook,
that has 2 new optional keys:

- "refName": to override the ref "autofocus" (effectively allows to run
the hook multiple times)

- "selectAll": selects the whole value of the input/textarea (instead of
putting the cursor at the end).

Part-of: odoo/odoo#97411
2022-08-25 12:05:02 +02:00
FrancoisGe 771fdcc67c [FIX] web: pick a non-enumerable property
Before this commit, pick did not work on non-enumerable properties.

For example, getters in a class are non-enumerable properties. It was not
possible to pick the value of a getter in a Class with the pick function.

closes odoo/odoo#97558

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-23 16:28:58 +02:00
Samuel Degueldre 38e7589042 [FIX] web: prevent crash when mixing hotkeys with and without area
Previously, when registering a hotkey without an area then a hotkey with
area, there would be a crash, as that latest hotkey is the candidate
winner, and we then check that there is no other matching hotkey with an
area that's more specific. In doing this, we assume all other candidates
have an area and call it as a function, but since some hotkey
registrations don't have one, we get a crash.

This commit fixes that by filtering the candidates to only those which
have an area before trying to narrow down to the most specific one.

Part-of: odoo/odoo#98535
2022-08-22 10:27:22 +02:00
Bruno Boi 3021a676de [FIX] web: don't apply TZ when serializing dates
# Before this commit
Serializing a date would apply the TZ offset of
the luxon's DateTime object in which it is contained.
This sometimes led to output the wrong date.

# After this commit
Serializing a date contained in a luxon's DateTime object
will not apply any TZ offset and will output a serialized version as-is.

# Note
If you still want to apply the TZ offset, you should do it manually:

    const toSerialize = date.setZone("utc");
    const value = serializeDateTime(toSerialize);

closes odoo/odoo#98194

Related: odoo/enterprise#30469
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2022-08-17 19:48:36 +02:00
luvi a818a9b732 [FIX] web: ColorPickerField behavior/style
This commit fixes the recently converted color_picker field
widget. It is now always opened in a list as in legacy,
no longer togglable and many style issues have been fixed.

In form views, we still toggle the opened state because
always edit is coming and it would bloat the UI to
keep it always open.

Tests has been added/modified to assert those desired
behaviors.

closes odoo/odoo#97872

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2022-08-16 16:28:17 +02:00
Lucas Perais d9257d3aae [FIX] web: core: domain supports domain as tuples
Have a domain declared somewhere in the XML as:
`("&", ("field", "=", "value"), ("field2", "=", "value2"))`

Before this commit, that expression made the Domain algorithm crash, because tuples
were not allowed.

After this commit, only tuples containing at least one other tuple and some optional strings are accepted.

closes odoo/odoo#97850

Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-08-16 16:28:14 +02:00
Jorge Pinna Puissant 34ddcab07f [IMP] web: Tooltip UX on touch-enable devices
Before this commit, in a touch device the behaviour was a
"tap-hold-to-show” which let the user see the Tooltip by pressing the
element, and letting it disappear when the pressure ends.

This commit allows choosing between the previous "tap-hold-to-show"
behaviour and a new "tap-to-show" which let the user see the Tooltip by
pressing the element, and keep it open until it press something else.
This behaviour is more adapted when the tooltip is on a specific icon,
as is the case for the labels, since : f981c5f8f0

closes odoo/odoo#97680

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-08-09 09:00:02 +02:00
Géry Debongnie 130a7d9ee1 [IMP] web, web_tour: improve isVisible helper
Before this commit, the isVisible helper would most of the time work as
expected, except if an element has display: contents.  In that case, it
has no bounding box, but it may still be visible if one of its child
is visible.

This is particularly important since we want to set the display property
of all field components to "contents".

Part-of: odoo/odoo#96865
2022-08-08 12:33:11 +02:00
Adrien Schoffeniels 9c5b5a9dfd [IMP] web: allow commands to be middle-clickable
Purpose
=======
Allow commands in the command palette to be opened in a new tab by
either CTRL+clicking on the command, CTRL+ENTER or right clicking and
copying the link/opening in new tab.

Specifications
=============
Add new slot `focusMessage` that displays the message (if device is not
a mobile device). The `href` value has then to be defined in the
registry.

Task-2710445

Part-of: odoo/odoo#94241
2022-08-05 12:09:54 +02:00
Xavier BOL (xbo) 650d0679c0 [FIX] web: fix autofocus when input type is 'number'
Before this commit, when the autofocus is used on an input with
`type="number", the `selectionEnd` is not available because the input
element's type ('number') does not support selection.

This commit checks the input type is not a number:
- if it is the case then the selection is used to place the cursor at
  the end of the input content,
- otherwise the selection properties are not used and the input is
  simply focused.

closes odoo/odoo#97466

X-original-commit: 38a5de7b2962a47c29b23f12f2ea7599bdea11fd
Signed-off-by: Xavier <xbo@odoo.com>
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-08-05 03:38:20 +02:00
Lucas Perais 6c155e1713 [FIX] web: relationalModel: basic keys supported in record context
Have an editable list view, displaying a many2many tags field. The m2m field
has a context, mentioning `active_id`. (`context="{'default_field': active_id}"`)

"basic context keys" is to be understood as the usual suspects: active_id, active_ids, current_company_id, active_model

Type something in the m2m input, and selet create and edit, in order to create a new record in a dialog form view.

Before this commit, there was a crash because active_id was not present in the evaluation context.

After this commit, the new record opens in its form view, with the right value for the field that must have a default.

closes odoo/odoo#96910

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-08-04 18:35:32 +02:00
Michael (mcm) a18ac8b272 [IMP] web: cache fields_get in DomainSelector
Before this commit, the DomainSelector did a lot of
RPCs to fields_get each time it was rendering.
Now, we use the view_service.loadFields which does the
RPCs and caches the results.

closes odoo/odoo#96852

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-03 11:06:30 +02:00
Michael (mcm) 80638a3f92 [FIX] web: get correct operator in DomainSelector
Before this commit, giving an unknown operator for a
certain field type made the DomainSelector crash.
Now the component lists all existing operators to find
one that matches and prevent crashing.

Part-of: odoo/odoo#96852
2022-08-03 11:06:30 +02:00
Bruno Boi 9d1786c361 [IMP] web: account for local timezone when formatting dates
formatDate and formatDateTime had their default 'timezone' option set to
false but this was changed to true in order to have the same behavior as
the legacy formatDate and formatDateTime functions.

Part-of: odoo/odoo#96946
2022-08-02 09:19:56 +02:00
Romeo Fragomeli a1dbac0f9b [FIX] web: adapt checkbox and boolean_toggle for BS5
In the BS5 migration, the legacy `checkbox` and `boolean_toggle` widget
were adapted but not the OWL Component.

Also, we have tweaked the old widget and the component to have better
positioning and margins.

Note:
the CSS for the print is already done in BS5
```css
@media print {
  .form-check-input {
    color-adjust: exact;
  }
}
```

Also we change `offsetWidth` by `getBoundingClientRect().width` in
`list_renderer` to avoid inaccurate rounding in columns width's
calculation.

Lastly a `.o-checkbox` class is added to the Checkbox component for a
more universal and context independent targetting.

closes odoo/odoo#96185

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-08-01 13:26:31 +02:00
Jorge Pinna Puissant cd624c891f [IMP] web: focus trap on the dialog
This commit will trap the focus on the dialog, this will avoid modifying
a background record when a dialog is open. Trapping the focus on the
dialog is a well-known technique for modals (dialog).

closes odoo/odoo#96361

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-28 08:10:42 +02:00
Samuel Degueldre c5e63850dd [FIX] web: fix tooltip rendering crashing because of lack of env
With the merge of the new views, we introduced an owl directive which is
t-call-context, that allows a t-call to execute in a controlled context
that is not the context of the component itself. In doing so, we forgot
that some existing templates rely on the presence of the env in the
rendering context for things like knowing if we are in debug mode or if
the device is small/mobile.

This commit fixes that by simply adding the env to the rendering context
of tooltuips.

closes odoo/odoo#96875

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-07-28 05:04:35 +02:00
luvi 37d7247df5 [REF] web: changes to the Notebook API
This commit fixes the API of the Notebook component
that mixed props of page templates with its attributes
(isVisible, title and index). Mixing page props and
attributes was confusing. Tests have been adapted
to reflect those changes.

closes odoo/odoo#96807

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-07-28 03:50:50 +02:00
Lucas Perais (lpe) d3f26c4aab [FIX] web: MainComponentContainer updates when registry changes
Before this commit, adding a component in the main component registry
after the initial mount did not work that is, the MainComponentContainer
never rendered the new component.

After this commit, adding a component to the registry works as expected.

Part-of: odoo/odoo#78221
2022-07-22 16:21:39 +02:00
Géry Debongnie b4063a1e73 [IMP] web: update owl from 2.0.0-beta-14 to 2.0.0-beta-16
Release notes:

https://github.com/odoo/owl/releases/tag/v2.0.0-beta-15
https://github.com/odoo/owl/releases/tag/v2.0.0-beta-16

Details:

- fix: lifecyle_hooks: correctly wrap errors in async code
- imp: use a custom error class for all errors thrown by owl
- fix: package.json: remove browser value
- ref: component_node: slightly simplify code
- fix: components: fix cause left unset when thrown object is not Error

Part-of: odoo/odoo#78221
2022-07-22 16:21:38 +02:00
FrancoisGe 5ee62cc927 [FIX] web: rename pluck to pick
Name error, the implementation of pluck is the pick function. So we will
rename the pluck function to pick.

Part-of: odoo/odoo#95945
2022-07-21 00:50:05 +02:00
Samuel Degueldre 106193e359 [FIX] web: fix useService binding service methods when it should not
Previously, the useService hook would call _protectMethod, which wraps
async methods so that any call to them after the component has been
destroyed throws an error, and any call that was started while the
component was alive but returned after the component was destroyed would
return a pending promise such that no more component code is executed.

In doing so, it would for some reason bind all the methods to the
service, this prevents some functionalities where a method would return
a differently configured version of that same service, on which you can
call the methods again (eg: orm.silent), as the modified service's
methods would not be bound to that modified service.

This commit fixes this issue by not binding the methods eagerly, and
introduces a test for all these behaviours.

closes odoo/odoo#96121

X-original-commit: 518a93a5487f62bd9b460412d4775cd0ac80a262
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-07-19 11:51:03 +02:00
Pierre Paridans f5ef77839f [IMP] web: Tooltip UX on touch-enabled devices
Port of legacy's BasicRenderer for WOWL views.

In a nutshell: Tooltips are problematic in touch devices as they are
meant to appear on hover... which doesn't happen with touch events.

This commit implements a "tap-to-show" behavior which let the user see
the Tooltip by pressing the element, and letting it disappear when the
pressure ends.

Part-of: odoo/odoo#95924
2022-07-19 11:50:51 +02:00
6acfad2651 [IMP] web: speed up pager total counter for large DB
Doing a `search_count` on millions of records could be very slow. On
large databases, the pager counter "1-80 / 8000000" could take several
seconds just to get the total number of records.

This commit limits the counter in list and kanban views to 10k records,
and shows "1-80 / 10000+" if the limit is reached. If you click on
10000+, it updates with the real count (or if you go up to 10000 with
pager or input value).

The search_count on res.partner of odoo.com takes 4s. With this patch,
it will take ~20ms.

Task 2761165

closes odoo/odoo#95642

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Damien Bouvy <dbo@odoo.com>
2022-07-19 11:50:24 +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) 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
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
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 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
Julien Mougenot 38710465a9 [IMP] web: Update to FileInput API
This commit changes the prop names of the FileInput component to bring
them in line with the current naming conventions. Also the default
route has been changed from '/web/binary/upload' to
'/web/binary/upload_attachment' since the latter is used more often.

Part-of: odoo/odoo#92475
2022-06-30 09:29:48 +02:00
Samuel Degueldre a7be88cd91 [REF] hr_contract, web: give tooltip info as t-call-context
Previously, we would use t-set to add the tooltip info under the key
"info" in the rendering context, while this works fine, it was mostly
just a workaround for the lack of support in owl for passing a rendering
context to be used by the t-call directly. Since this is now supported
in owl, the commit uses this feature for the tooltips and adapts the
call sites.

Part-of: odoo/odoo#92475
2022-06-30 09:29:47 +02:00
Michael (mcm) b1f072cba4 [IMP] web: adapt dialog for mobile
This commit modifies the dialog to make it more user
friendly on small screen. On small screen, the dialog
opens in fullscreen and saves the scroll position when
opening to restore it on close.

Part-of: odoo/odoo#92475
2022-06-30 09:29:46 +02:00
Aaron Bohy af0f323bac [REF] web: adapt debug items to new views
This commit adapts the (form) view debug items to make them work
with the new owl kanban, list and form views, and to make them
use the new owl SelectCreateDialog.

Part-of: odoo/odoo#92475
2022-06-30 09:29:44 +02:00
+2 48ef812a63 [REF] web: kanban, list and form views in owl
This commit introduces the new kanban, list and form views written
in owl. Even though it contains the implementation of those 3 views,
only the kanban view is activated for now (the list and form views
aren't 100% ready yet, so they aren't added to the view registry).

Alongside the views, the fields (<field name="..."/> in archs) and
widgets (<widget name="..." in archs) of web/ have been implemented
in owl as well. Legacy ones remaining in other addons are supported
in our new views, thanks to a compatibility layer. The goal is to convert
them asap though.

Legacy views, fields and widgets are kept for now, which explains the
number of added lines in this PR (around half of them concern tests).
They are still extended by custom code in other addons, that still need
to be converted (a lot of them are already on the way). Moreover,
they are still used in Studio as well. The plan is to lazy load them in
the Studio bundle when all custom code extending them will be
converted. Studio will be converted for v17.

Part-of: odoo/odoo#92475
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: luvi <luvi@odoo.com>
2022-06-30 09:29:44 +02:00
Aaron Bohy 8697a136c3 [IMP] web: tooltip: style, delay and empty tooltips
This commit is threefold:
 1) it improves the style of tooltips (mostly, a larger font size)
 2) it adds an option, `data-tooltip-delay` that allows to specify
    the delay before the tooltip opens
 3) it handles the case where the tooltip is empty (no tooltip
    displayed)

Part-of: odoo/odoo#92475
2022-06-30 09:29:43 +02:00