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
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
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.
closesodoo/odoo#97466
X-original-commit: 38a5de7b2962a47c29b23f12f2ea7599bdea11fd
Signed-off-by: Xavier <xbo@odoo.com>
Signed-off-by: Samuel Degueldre <sad@odoo.com>
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.
closesodoo/odoo#96910
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
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.
closesodoo/odoo#96852
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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
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
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.
closesodoo/odoo#96185
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
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).
closesodoo/odoo#96361
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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.
closesodoo/odoo#96875
Signed-off-by: Géry Debongnie <ged@odoo.com>
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.
closesodoo/odoo#96807
Signed-off-by: Samuel Degueldre <sad@odoo.com>
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
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.
closesodoo/odoo#96121
X-original-commit: 518a93a5487f62bd9b460412d4775cd0ac80a262
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Samuel Degueldre <sad@odoo.com>
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
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
closesodoo/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>
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"`.
closesodoo/odoo#95891
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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.
closesodoo/odoo#95921
X-original-commit: fd7c2c0c14bfaac228abacb265278157eec4aad0
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
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.
closesodoo/odoo#95492
Task-id: 2906623
Related: odoo/enterprise#29230
Signed-off-by: Géry Debongnie <ged@odoo.com>
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.
closesodoo/odoo#95570
X-original-commit: be5c8d0fc340b3e2ad9721d21ef1133870d8a774
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Xavier <xbo@odoo.com>
- 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
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
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
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
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
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>
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
This commit adds two options to the hotkey service to improve its
usability in some cases:
- `area` which is a function that returns an HTMLElement that restricts
the operating area for an hotkey registration
- `validate` which is a function that returns a boolean that tells if
the hotkey registration's callback should be called or not
Some typings adaptations were made in:
- @web/core/commands/command_palette
- @web/core/commands/command_service
- @web/core/utils/ui
Part-of: odoo/odoo#92475
1) Force the cursor: pointer for dropdown items containing a
checkbox (e.g. optional field dropdown in list views)
2) Always stop click events in dropdown togglers as they are
handled
3) Add a test for the "tooltip" props
Part-of: odoo/odoo#92475
This commit introduces a ColorList component which allows to
choose a color from a list. There are several usecases for such
a component in Odoo (e.g. ColorPicker, Many2ManyTags, KanbanRecord).
Part-of: odoo/odoo#92475
This commit introduces the DomainSelector and ModelFieldSelector
components. They will especially be used by the owl DomainField.
Part-of: odoo/odoo#92475
This commit introduces a Notebook component, which displays tabs
and an active page. The component is configurable to display the
notebook vertically (e.g. form views) or horizontally (e.g. kanban
examples dialog).
Part-of: odoo/odoo#92475
This commit introduces an AutoComplete component, which displays
an input and reacts to input events to display a list of suggestions
in a dropdown. The main usecase for this component is the Many2One
field.
Part-of: odoo/odoo#92475
This hook offers an alternative to jQuery UI sortable and
draggable. It's a step in the way to removing jQuery UI. This
hook will be used by the new owl list and kanban views.
Part-of: odoo/odoo#92475
By passing "animationFrame" as delay value, the debounced function
will be called just before the next animation frame following the
moment if has been effectively called.
Part-of: odoo/odoo#92475
Before this commit, opening a notification with the className
option would result in a notification being displayed without the
given className. That className was overriden by the transition
className. This commit ensures we keep all classNames.
Part-of: odoo/odoo#92475
In the wowl codebase, we use luxon instead of moment to manipulate
dates. Moment was able to parse dates with short notations (e.g.
08/15/22 for the format MM/DD/YYYY). Luxon is more strict and does
not support those cases (the format must be perfectly respected).
As a consequence, moving from moment to luxon would introduce a
regression in our date and datetime fields. This commit implements
the same kind of logic as what is done in moment, in our date
parsers, such that those cases are handled.
Part-of: odoo/odoo#92475
This commit ensures that keys in the hash or querystring in the url
is URI encoded. Moreover, it properly handles the case where a
value in the hash is falsy. Before this commit, if a value, say "x",
was falsy, it resulted in the url in "x", which produces a crash
when decoding. With this commit, it generates "x=" in that case.
Part-of: odoo/odoo#92475
Before this commit
When the user hit ctrl+k on a mass mailing, no command palette nor link
dialog was opening.
This was due to the fact that the hotkey service would not react
to hotkeys being pressed from inside of an iframe element.
After this commit
One can now register an iframe to the hotkey service to let it react
to hotkeys being pressed from within the registered iframes.
task-2738457
closes odoo/odoo#91102
Forward-port-of: #89940
Forward-port-of: #82994
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Whenever the user hit ctrl+k when being on an html field, both the
link dialog and the command palette opened.
In order to resolve the conflict, now ctrl+k open the command palette
with the first entry being the command to open the linktool and
a subsequent hit to ctrl+k when the command palette is open to open
the link dialog.
Task-2738457
Forward-port-of: #89940
Forward-port-of: #82994
Part-of: odoo/odoo#91102