Commit Graph
531 Commits
Author SHA1 Message Date
Michael (mcm) 04fddc19d4 [IMP] web: improve patch function
This commit refactors the patch function in order to simplify its code
but also and most of all remove the `this._super` bound on each patched
method call.
The patch function now supports the javascript keyword `super` to
get the parent's property.
This removes constraints we had with `this._super`. We had to create a
rather complicated intermediate function to bind `this._super` and this
function was called each time before we called a patched method.
It was annoying for debugging but necessary. Because of this
intermediate function `this._super` was also had to re-bind each time
we entered a patched method which was annoying with async method, we
had to save the parent method in the patch before awaiting its
execution. Finally, not a big issue but still, objects could not have a
`_super` property as it would be hidden in the patch.

task 3410198

Part-of: odoo/odoo#125716
2023-08-02 17:29:05 +02:00
Aaron Bohy c10b5d0b1b [REF] web,*: tests: remove legacyExtraNextTick
Now that most of the webclient codebase (fields, views, client
actions...) has been converted to owl, the legacy extra next tick
used in a lot of tests is no longer necessary. This commit removes
the helper and its usage. At some places, a real tick was needed,
but we didn't see it because of the use of the legacy extra next
tick.

Part of task~3439226

closes odoo/odoo#130236

Related: odoo/enterprise#44869
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-08-01 23:52:30 +02:00
Pierre Pulinckx (pipu) 60fe2e9b17 [REF] *: remove _lt()
In a previous commit 8bfa76a, _lt() returns _t().
So, in this commit, all usages of _lt() are replaced by _t().

task-3292454

closes odoo/odoo#130179

Related: odoo/enterprise#44906
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2023-08-01 13:51:17 +02:00
Pierre Rousseau 036307ba26 [REM] web, *: remove legacy dialog
OwlDialog is not used anymore, therefor we can remove it.

Task-id 3439226

closes odoo/odoo#129774

Related: odoo/enterprise#44634
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-07-31 19:02:58 +02:00
Jorge Pinna Puissant 96b6b6591f [FIX] web: code editor shouldn't accept markup as value
Before this commit, when using the ace field widget with a html field,
the markup value of the field was sent to the code editor. The issue
with this is that the ace library only accept strings (it will extract
the string from the markup), and when ask for the current value, it will
respond in string. Because of this, the ace field will always be
considered as dirty, even if not modified, because it will compare the
initially sent value (a markup) with the value given by the library (a
string).

Now, the formatText used on the ace field will always send a string
(remove the markup). And the code editor will check the props to only
accept strings.

X-original-commit: 1778672e9b0076bf385d46e68efb4914d6bf790c
Part-of: odoo/odoo#129995
2023-07-28 16:29:17 +02:00
Aaron Bohy 7dc6958334 [FIX] web: can partially evaluate complex dynamic context
Have a form view with an x2many field, and a context on that field,
depending on other fields of the view. For instance:
 ```xml
   <form>
     <field name="a"/>
     <field name="b_ids" context="{'key1': a, 'key2': 4}"/>
   </form>
 ```

As we read records in a single rpc (unity read), we need to be able
to (at least partially) evaluate the context set on b_ids to build
the field specification for the web_read call. The problem is that
the evaluation context is incomplete when we want to evalute it, as
we don't know the value of `a`.

Before this commit, we evaluated that context by adding "sentinel"
values in the evaluation context (a sentinel being a Symbol), and
we removed all keys whose values had been evaluated to the sentinel
afterwards. This worked for the example above (we were able to
generate the context `{ key2: 4 }`).

However, this wasn't flawless. For instance, with
 ```xml
    <field name="b_ids" context="{'key1': a + b}"/>
 ```
our sentinel strategy didn't work, because you can't perform such
operations on a Symbol.

This commit comes with another strategy, which is actually easier,
and which handles the above case. We now parse the context, and
evaluate each value individually (if it needs to be evaluated). If
the evaluation crashes, we swallow the error and do not add that
particular key to the evaluated context.

Part of task~3179751

closes odoo/odoo#129925

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-07-28 14:54:02 +02:00
Bastien PIERRE 65242e31e9 [IMP] *: Remove alias in JS files
Rename all imports with alias old system to the new js module system
Task ID: 3266759

closes odoo/odoo#127414

Related: odoo/design-themes#671
Related: odoo/enterprise#43716
Signed-off-by: Bastien Pierre (ipb) <ipb@odoo.com>
2023-07-27 11:58:34 +02:00
Hubert Van de Walle (huvw) f478310d17 [FIX] web: prevent rollback in ace_field
Steps to reproduce
==================

- Enable debug mode
- Go to Settings / Technical / Automation / Automated Actions
- Set "Action To Do" to "Execute Python Code"
- In the code editor, type really quickly

The code is briefly focused and when the next input is processed,
everything is erased.

Cause of the issue
==================

The AceField makes a debounced commit with the current editor value.
This triggers an onChange event, and upon receiving the results,
we update the editor value with the resolved value.
Although the editor value may have changed in the meantime,
we still revert it to the previous value.

Solution
========

There is no need to update the record every 10ms. We can simply to that
on blur. This is also what was done in 16.2.

opw-3379740

closes odoo/odoo#129694

X-original-commit: 4047ed03117fbcd5634843e29dc82e7ffb71b910
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2023-07-26 13:22:09 +02:00
Aaron Bohy f16e23c23f [IMP] web: orm service: add "webRead" function
This commit adds a shortcut in the orm service to call the new
"web_read" python method and adapts the few calls to use it.

closes odoo/odoo#129502

Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-07-25 13:26:37 +02:00
Aaron Bohy c80f76da56 [REF] web: specialize useModel for sample data
Before this commit, there was a hook, named useModel, which eases
the use of a model in views. The main (and almost only) role of the
hook was to deal with sample data (determine whether or not they
can be enabled, fallback on the sample orm when necessary, leave
sample mode at reload...). This hook is used by all views except
form and activity as they do not implement sample data.

This commit renames that hook into "useModelWithSampleData" and
introduces a new hook "useModel", which is a lot simpler that the
other one, as it's only goal is to do the plumbing between the
component using the hook and the model (i.e. spawning required
services and loading the data on willStart and willUpdateProps).
This new hook is used in form and activity views.

Note that useModel doesn't trigger deep renderings, as it is only
used on the RelationalModel which is based on fine-grained
reactivity.

Part-of: odoo/odoo#114024
2023-07-24 20:17:54 +02:00
8723f020c3 [REF] web: new RelationalModel
Before this commit, we had several implementations of a relational
model. The form view used the BasicRelationalModel, which was a
wrapper around the BasicModel. The list view used the
RelationalModel (a simpler version that didn't support complex
usecases of x2many fields). The kanban view used the KanbanModel,
an extension of RelationalModel.

This commit removes all these, and replaces them by a single model.
It is called RelationalModel, and as a similar structure as its
predecessor (with datapoints). It now handles tricky x2many usecases
of the form view though.

This commit also comes with several important changes:
 1) The new model is based on unity reads [1]. This means that all
 data required by the view is fetched at once, and datapoints are
 created with their data (whereas before, they were responsible to
 fetch their data). There's an exception for special data: they are
 no longer handler by the model. A hook "useSpecialData" has been
 created, and it allows fields (components) to fetch additional
 data they require.

 2) The new model uses onchange2 [2]. With onchange2, we send and
 receive a diff, instead of the whole state of the record. Morever,
 onchange2 uses unity, which means that returned commands for x2manys
 (e.g. command 4, LINK) contain the values of the corresponding
 records, so we don't need to fetch them in a separate call
 afterwards.

 3) The new model no longer triggers deep renderings (render(true)).
 It is instead based on fine-grained reactivity (i.e. only what
 depends on what has changed is re-rendered). We introduced a hook
 "observeRecord" which allows a component to subscribe itself to
 some keys in a record datapoint, and register a callback to
 execute when those keys change (e.g. to fetch data).

[1] odoo/odoo@7d2baaa0c7
[2] odoo/odoo@f5e6494da3

Task~3179751

Part-of: odoo/odoo#114024
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: FrancoisGe <fge@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: Pierre Rousseau <pro@odoo.com>
2023-07-24 20:17:50 +02:00
Leonardo Pavan Rocha c4994c7d10 [IMP] web: changes in name and signature for sign
This commit adapts the NameAndSignature component to allow usage in the sign
module by enabling customization of behavior when "auto" and "load" buttons are
clicked. It also replaces the top buttons for fa icons for a cleaner UI and
adds autofocus to the name input field.

task-3286974

Part-of: odoo/odoo#126296
2023-07-20 11:49:17 +02:00
Pierre Pulinckx (pipu) 8bfa76a842 [REF] *: Unify _t and _lt
The goal of this commit is to prepare ground to remove
lazytranslate function _lt() and keep only _t()
for a better understanding of the use of the translation function.

In this commit,

the translate function _t() has been updated to return the translation
if they are loaded. If not, it throws an error.
the lazytranslate function _lt() returns _t() function.
Corollaries :
Steps in test tours are now a function that returns an array of steps
to avoid any interpolation of _t in this ones before translations has
been loaded.

Example :

registry.category("web_tour.tours").add("example", {
    test: true,
    steps: () => [
        {...},
        {...},
    ],
});

task-3292454

closes odoo/odoo#124157

Related: odoo/enterprise#43153
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-07-19 13:13:16 +02:00
Mathieu Duckerts-Antoine 4e70ca384d [FIX] web: domain selector dialog: validate domain on confirm
With ab4f45b, the domain validation done
on confirmation in the domain selector dialog was removed. Now that we
have a new route /web/domain/validate (see previous commit) that allows
us to quickly check the validity of a domain, we can reintroduce the
validation.

closes odoo/odoo#128913

X-original-commit: fa7788fac3c48e95dcbe78abb66ac5c284d27c56
Related: odoo/enterprise#44291
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-07-19 11:40:10 +02:00
Mathieu Duckerts-Antoine fb9629cb6d [IMP] web: domain selector: autocompletion for relational fields
For the relational fields and the operators =,!=,in,not in, we allow
the user to use autocompletion as in a many2one or a x2many field.

Task ID: 3291990

Part-of: odoo/odoo#121688
2023-07-13 14:47:12 +02:00
Mathieu Duckerts-Antoine 56ede17854 [IMP] web: domain selector: display in readonly mode
We improve the readonly mode in several ways:

    - instead of displaying ids for relational fields, we display the
      associated names.
    - instead of displaying values for selection fields, we display the
      associated labels.
    - quotes around strings are not displayed by default. They are if
      there is some ambiguity: the presence of a value of another type
      like 0, false or an expression makes necessary to put them.

Task ID: 3291990

Part-of: odoo/odoo#121688
2023-07-13 14:47:12 +02:00
Mathieu Duckerts-Antoine a1365d7655 [IMP] web: model field selector: search on string and name in debug mode
We allow the user to make a fuzzy search on the string and the name of
the fields when the props isDebugMode is true.

Part-of: odoo/odoo#121688
2023-07-13 14:47:11 +02:00
Mathieu Duckerts-Antoine a3b00f2dca [FIX] web: domain selector: operators with same key
Before that commit, we could get two operators with the same key to
display at the same time. In that case, an error would be thrown by OWL:
Got duplicate key in t-foreach... . We fix that problem.

Part-of: odoo/odoo#121688
2023-07-13 14:47:11 +02:00
Mathieu Duckerts-Antoine bac8c7a5d6 [FIX] web: domain selector dialog: do not validate domain server side
Even with a limit of 1, the domain validation done in the domain selector
dialog at confirmation can be too costly (see PR message). Since we do
not have (yet) the tools to validate quickly domains server side, we
simply drop the validation server side.

closes odoo/odoo#127832

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-07-13 03:57:40 +02:00
Julien Mougenot fd64757d82 [FIX] web: fix focus issues with datetime hook
Before this commit, the way focus was handled by the DateTime feature
hook was inconsistent. This caused the date/datetime/daterange fields to
not be able to open the picker when clicking on the "Add start/end date"
button, and effectively lose the value set on the field on save.

This commit introduces a more consistent focus handling as well as a
helper returned by the hook to open the picker on command.

Part-of: odoo/odoo#127734
2023-07-12 16:53:10 +02:00
Lucas Perais 1e5c256294 [FIX] web: CodeEditor: resource-specific session
The new CodeEditor dismissed the notion of ace EditSession.
This serves to split the ace internals (history, values etc...) according
to the logical unit of a session.

After this commit, from the CodeEditor point of view for each edited resource (a view mostly)
corresponds one session.

Part-of: odoo/odoo#126963
2023-07-12 03:48:48 +02:00
luvi 8a4485748f [FIX] web: fix filtering when choices/groups props update
This commit fixes the filtering of choices when the choices or the groups
props values are updated. Before this commit, the filter was only triggered
when the length of choices or groups differ.

Instead, it is prefered to apply the filter of choices whenever those props
are updated (in a dedicated useEffect).

A test has been added, updating the choices props, while having an object with
the same number of choices, while having different values. Before this fix, the
filtering wouldn't be applied correctly, since the filter wouldn't be triggered
because the object has the same number of values in it.

closes odoo/odoo#127733

Signed-off-by: Bastien Fafchamps (bafa) <bafa@odoo.com>
2023-07-07 16:42:38 +02:00
Lucas Lefèvre (lul) 6ea05e844a [IMP] web: evaluate domain with user context
Currently, the domain editor dialog doesn't handle domains like
[('foo', '=', uid)] if you don't provide the (user) context in the
component props.

Since this kind of domain is expected to work everywhere, the component
now uses the user context by default to evaluate the domain.
There's no need to provide the context everytime the component is used.

closes odoo/odoo#127565

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-07-06 17:52:43 +02:00
Lucas Lefèvre (lul) b0fdb2b429 [REF] web: factorize makeDialogTestEnv helper
With this commit, the many identical implementation of
`makeDialogTestEnv` are removed in favor of a single
helper function.

Part-of: odoo/odoo#127565
2023-07-06 17:52:43 +02:00
Lucas Lefèvre (lul) 82ec77def7 [FIX] web: display contextual values in readonly domain
The domain component in readonly mode doesn't display dynamic/contextual
values.
For a domain `[('foo', '=', uid)]` the component displays "foo =" instead
of "foo = uid"

Part-of: odoo/odoo#127565
2023-07-06 17:52:42 +02:00
Michael (mcm) ac153558a6 [FIX] web, mail: indirectly call a patched function
The commit [1] removed two async module and caused a reorganisation
on the module loading.
Since that commit, the patches could be applied in a different order
and be applied after a save of one these patches.

This commit fixes a case where we save the reference of a patched
function that we call it later with missing patches.

[1]: 96687f29496ab4cf16ae2ab1584ef1a6a3fb4a11

Part-of: odoo/odoo#121185
2023-07-05 15:58:20 +02:00
Michael (mcm) 03ad36676f [FIX] web: reset uniqueId to 0 in tests
The commit [1] removed two async module and caused a reorganisation
on the module loading.
Since that commit, `uniqueId` did not begin with the id 1 in its test
and so the test failed.
Now, the variable containing the last id of `uniqueId` is set on the
function itself. This allows us to reset the id in the test.

[1]: 96687f29496ab4cf16ae2ab1584ef1a6a3fb4a11

Part-of: odoo/odoo#121185
2023-07-05 15:58:19 +02:00
Ali Alfie (alal) 3c6c6e6bb3 [IMP] web: rename cancel button in RedirectWarning to close
"Cancel" button in the RedirectWarning is renamed to "Close"

task-3339621

closes odoo/odoo#125751

Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2023-07-03 21:55:53 +02:00
Mathieu Duckerts-Antoine 1c2c18a0a5 [FIX] web: domain selector: invalid path/operator
We make the domain selector accept any expressions in the first and
second components of a domain condition. Along the way, we have found
necessary to refactor the Tree type (see domain_tree.js) and use it
directly in the domain selector instead of having yet another auxiliary
structure. Another simplification brought by this commit is that the
virtual operators is, is_not, set, and not_set are introduced earlier
and make possible to simplify the way operators are managed.

closes odoo/odoo#126350

Related: odoo/enterprise#43161
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-07-03 16:58:55 +02:00
Mathieu Duckerts-Antoine 2b23f73f51 [IMP] web: domain selector: use TagsList in TagInput
We make TagInput use the generic component TagsList. This gives a better
looking/working to the editors used for the operators "in"/"not in" for
char fields.

Part-of: odoo/odoo#126350
2023-07-03 16:58:55 +02:00
Mathieu Duckerts-Antoine 1b94eefe26 [FIX] web: domain selector: treat false,true as in py interpreter
A string representation of a domain like "[('bar', '=', false)]" is
evaluated by py.js the same way as "[('bar', '=', False)]".So both domains
are recognized as correct while false is not a valid python expression.
We do the same in domain selector, the expression "false" ("true")
will be understood as "False" (resp. "True").

Part-of: odoo/odoo#126350
2023-07-03 16:58:54 +02:00
Mathieu Duckerts-Antoine 089e0e680c [IMP] web: domain selector: in/not in labels
We change the label of "in" to be "is in". The label of "not in" becomes
"is not in"

Task ID: 3291990

Part-of: odoo/odoo#126350
2023-07-03 16:58:54 +02:00
Julien Mougenot 5b2593e675 [REF] web: Make datetime hook independant from props
This commit makes the datetime hook independant from the props update
mechanism it previously relied on (onWillStart & onWillUpdateProps) to
update its internal props.

This was an incoming issue as the future relational model will rely on
fine-grained reactivity to update the fields rather than updating the
model and re-rendering all child components (effectively calling
'onWillUpdateProps').

Now, the hook relies on an internal state that tracks whether the props
given by its caller changed from one render to another, which is checked
at render time (i.e. in 'setup' and 'onWillRender').

closes odoo/odoo#125039

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-07-03 12:21:05 +02:00
Julien Mougenot e74672d71d [REF] web,*: Centralize shallowEqual
Before this commit, 2 implementations of a "shallowEqual" function
coexisted, one in 'web/core/utils/objects.js' and another in
'web/core/utils/arrays.js'.

This commit only keeps the one in objects.js and makes the other simply
import and export it as well (easier to maintain while also easier to
find for those who want to work with arrays), while also taking an
optional comparison function argument in case the comparison needs to be
more specific (e.g. compare DateTime objects).

Part-of: odoo/odoo#125039
2023-07-03 12:21:05 +02:00
Bruno Boi 190c0cc215 [FIX] web: fix undeterministically failing test
Since [1], a test introduced in [2] was failing undeterministically.

**Explanation**
Commit [1] introduced a positioning recomputation when a load event
occur in the target's document.
The failing test in [2] loads an inline stylesheet inside of an iframe
without waiting for it to be loaded.

When the test failed it was because of the "load" event of the
aforementioned stylesheet that occured at an inappropriate moment.

Now the test awaits for this event.

Note that within the same conditions in the real world, we want to
make sure the popper is repositioned.
So this current fix is a bit cheating but the test is about testing
an unrelated behavior, so this is acceptable IMO.

Runbot error id: 22544

[1]: 532c4cfa4e60bc9531
[2]: 208a1277750d63eef3

closes odoo/odoo#126938

X-original-commit: 3ca170bf31ca6e6f12293f0dabe106d385773333
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-06-30 13:08:31 +02:00
Chrysanthe (chgo) 75dc7cfb9f [FIX] web: fix datetime_picker color scheme
=== ISSUE ===

With Milk, we introduced a change related to the active state color
meaning that the `active` state should use the following SCSS variables:

- $o-component-active-bg for the background ;

- $o-component-active-color for the text ;

- $o-component-active-border for the border.

The datetime_picker component was currently using the primary variable
which is not the expected color. This change also affects the different
states of the datetime picker (hover, click, ...)

=== AFTER ===

We apply the right variables on the component for consistency purpose,
and make some little design adjustments using `:before` and `:after`
pseudo elements to stylize the different states.

task-3329797
part of task-3326263

closes odoo/odoo#126728

X-original-commit: df0e75d36bfe85bdbe0a9823003e0849c17a9405
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-06-28 23:02:35 +02:00
Rémy Voet (ryv) 3c62ca1eb9 [REM] core: remove name_get API
Rationale
=========

Since v8, the `display_name` field is present on all models. By default,
`display_name` uses `name_get` which has pretty much the same purpose
(return record name used by the web client). Gradually, many (backend)
developers (and the ORM: https://github.com/odoo/odoo/commit/6da1c3ac4c036eac289597602976538e243cb939)
started using `display_name` (more convenient than
`record.name_get()[0][1]`) but it still had the `name_get` override.
It becomes more complex than necessary and poeple start to misunderstand
the two (and sometimes override both, leading to inconstiencies between
`display_name`/`name_get`).

To simplify the ORM and the API, we decided to keep only one of them,
the `display_name` field:
- It is much more convenient from a backend point of view
(`record.name_get()[0][1]` vs `record.display_name`)
- It is cached during the same transaction (and invalidated if
its dependencies change)
- It can be overridden like any other compute field (override
`_compute_display_name` with any extra dependencies)
- `name_get` is replaced by `read(['display_name'])`
(API perceptive), which can actually be more efficient
(if `display_name`'s depends are correct, the ORM will only fetch the
fields it needs instead of every prefetchable field)

Changes
=======

- Deprecates `name_get` for the v17 and based the method on
`display_name` (the opposite of before)
- Converts all usage of `name_get`
- Overrides of `name_get` are now overrides of `_compute_display_name`
- For `res.partner`, rename the field store `display_name` into
`complete_name` because `display_name` context-dependent and it makes
no sense to have a compute store that is context-dependent.
- Previously, it was possible to return multiple names for the same
record with `name_get`, but it was tricky and most of the usage of
this `name_get` didn't take this into account. The only example of
this is the `name_get` of `product.product`
(now use `", ".join(<names>)`).

Part-of: odoo/odoo#122085
2023-06-28 17:41:19 +02:00
Géry Debongnie 9f6ed9f6d1 [IMP] web: display empty screen when switching app/menu
The goal is to provide a better feedback to the user, especially in
mobile mode. With this commit, when switching menus, we clear the screen
and display an empty control panel (only for act_window actions though)
so we have some initial content that get filled as soon as the
view/action is ready.

Task 2900847

closes odoo/odoo#124068

Related: odoo/enterprise#43038
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-06-23 16:35:15 +02:00
Julien Carion (juca) 73a9154be8 [IMP] web: add ctrl+enter shortcut to dialogs
This commit adds the ctrl+enter shortcut to dialogs which will trigger
a click on the first visible button in the dialog's footer.

Task-3369676

closes odoo/odoo#125330

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-06-22 18:29:38 +02:00
Julien Mougenot 23e0ac2a1a [IMP] web: Support pointer events in draggable
This commit:

- adds a "delay" parameter to the `draggable_hook_builder`, waiting for
that delay on pointer down events before triggering the drag sequence
(making it possible to use "long mousedown" events);

- changes the event detection in `draggable_hook_builder` to listen
for pointer events instead of mouse events, effectively supporting the
drag and drop feature on touch devices;

- adapts the test helpers (with some refactors to `triggerEvent` and
other utility functions) to make them use pointer events instead for
drags and drops;

- adapts the tour utils to use a tone-downed version of the refactored
test utils `dragAndDrop` function;

- also changes events in list view which does not yet uses the draggable
hook, but should still work with the same helpers in tests.

Part-of: odoo/odoo#116005
2023-06-22 15:40:43 +02:00
MerlinGuillaume 08e2409afe [FIX] web: reposition popover when image is loaded
When hovering over an employee's photo (without edit rights) and the
image hasn't been loaded in the cache, the popover is positioned to the
right of the image. With a big image, the popover can be outside of the
page.

Steps to reproduce:
1. Install Employees and set a 4k image to any employee
2. Remove all the rights of Marc Demo on Employees
3. Connect as Marc Demo
4. Open the form of the employee with the 4k image
5. Hover on the employee photo
6. The image position is off

Solution:
Update the position of the popover when the image is loaded and restrict
the image width in the popover to the popover width

Problem:
When we try to find the best position to display the popover and the
image is not loaded, we will find that there is some room for the
popover on the right because the image has no height or width

opw-3281649

closes odoo/odoo#125951

X-original-commit: 532c4cfa4e60bc95319b774794680eabc80b1219
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2023-06-21 20:10:31 +02:00
stefanorigano (SRI) b0baac6fc4 [FIX] web, mail: Dropdown and PopoverWowl, increase contrast
This commit adapt several components and utility-classes in order to
increase visual contrast.

In the case of `o-mail-ActivityGroup` and `o-mail-NotificationItem`
templates, these has been reworked in order to use default BS components
and consequently automatically inheriting the improved design.

task-3338419

closes odoo/odoo#124903

Part-of: task-3326263
X-original-commit: 190ec1c947e17b2b4aa8614e9e0a04d00cb38d90
Related: odoo/enterprise#42507
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-06-21 00:13:49 +02:00
Samuel Degueldre 34bdde7204 [IMP] web: add tests and comments for reactivity utils
The reactivity utils were initially an ad-hoc solution to some problems
that came up when using the reactivity in places that are not
components. As it turned out that these needs are actually quite common,
the utils that were originally duplicated in many modules were moved to
the core utils in web, but there were no tests for these utils, and the
Reactive class was not documented.

This commit adds some tests for the reactivity utils and a docstring
motivating the existence of the Reactive class.

closes odoo/odoo#125549

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-06-19 16:40:01 +02:00
Bruno Boi debefffd26 [FIX] web: sync reposition for nested poppers
This commit will have nested components making use of
the usePosition hook to synchronize their repositioning.

**Before this commit**
Each component handles its own repositioning logic.
If it is mounted somehow inside another component using that
same logic, conflicts occur in some circumstances.

**After this commit**
It is now ensured that, in case of nested positioned components,
the whole chain of repositioning computations is called in the
proper order: from the parent to the children.

**Example**
- Before
  ![before]
- After
  ![after]

[before]: https://github.com/odoo/odoo/assets/1159815/3c9cfae7-db68-4707-a73c-ad7e2e71d4bf
[after]: https://github.com/odoo/odoo/assets/1159815/a21f56e0-d8e3-48c1-9509-8e6ee5040d4b

closes odoo/odoo#125531

X-original-commit: 9f947ba3fd3a00a0c80efc40186c36e0de78de16
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-06-19 09:30:58 +02:00
Lucas Perais c77fd9285e [FIX] web: CodeEditor: restore scrollability
Before this commit, the CodeEditor made Ace display infinity lines in height.
This prevented Ace to be scrollable in some contexts.
Specifically, when Ace was in a flex context, the scroll did not work.

After this commit, the CodeEditor takes an optional maxLines props to pass to Ace.
If not set, Ace will just adapt the number of lines to the size it gets.

closes odoo/odoo#124656

X-original-commit: eb81a4c857a249e4cd2f28b455d87b64a8e93c9a
Related: odoo/enterprise#42367
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2023-06-13 10:13:22 +02:00
Julien MougenotandJorge Pinna Puissant 1e959827b2 [FIX] web: Fallback to latin numbers when parsing dates
Before this commit, when inputting latin numbers (i.e. 0-9) with a
locale using a numbering system different than "latn" (e.g. "arab"),
the parsing failed resulting in an error.

The issue is that these locales often support both their numbering
system as well as the "latn" one. This commit makes the parsing fall
back to the "latn" system in case latin numbers are found in the input.

OPW-3316325

closes odoo/odoo#124635

X-original-commit: 12970754fc915eb181e040d3e45fc566fe310167
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
2023-06-12 15:27:00 +02:00
Mathieu Duckerts-AntoineandLucas Lefevre f2edbb27f4 [IMP] web: name service
We define a new service "name". That service makes possible to load in
batch display names and maintains a cache. Some known display names
(fetched otherwise) can be added to the cache. The cache is cleared at
least each time the UI is updated via _updateUI (action service).

Part-of: odoo/odoo#124090
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Lucas Lefevre <lul@odoo.com>
2023-06-09 17:00:47 +02:00
Bruno Boi 8d1700c3af [FIX] web: fix sub-dropdown alignment
Since [1], the sub-dropdowns are misaligned as soon as the user
interacts with them.

**Before this commit**
![before]

**After this commit**
![after]

[1]: e6bdce9025fb106bc9dd7bc99c67be4df6365f22
[before]: https://github.com/odoo/odoo/assets/1159815/a293ebe1-30cc-4397-9e17-c0813846922b
[after]: https://github.com/odoo/odoo/assets/1159815/7a151e51-a4e5-45e0-a1bf-61e89ae8aabb

closes odoo/odoo#124439

X-original-commit: 2f5055861f46cce77ae8687f546aff68ff262366
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-06-09 13:50:04 +02:00
Romeo Fragomeli 976491e012 [IMP] web,*: add accordion menu component
* = project,website

On the small screen, the sub dropdown is a bit weird to positioning, so
we use an accordion instead.
We apply this change also on desktop to avoid split behavior between
small screen and bigger screen and also to avoid duplicating code.

Also, we have made some DOM/CSS change:
* avoid reflow of the search bar menu by adding a min-width on the
  columns and a max-width on the input for custom groupbys and favorite
  filters
* re-align caret vertically for accordion indicators
* reword favorite edition items and add a tooltip
* all menu items have the class `o_menu_item`

closes odoo/odoo#122635

Note: DOM and some tests were adapted to reflect the change
Task-id: 3276542 (Part of)
Related: odoo/enterprise#41563
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-06-08 16:10:05 +02:00
luvi 0302e2f4df [IMP] web: add onInput props to SelectMenu
This commit adds the onInput props, allowing to run code from the parent
of the SelectMenu depending on the search value. This can be used in
situations where the list of choices must be dynamic. Also, whenever the
list of choices or groups is edited in length, the menu is filtered using
the newer values.

For example, choices can be generated from a fetch of items. Now, instead
of loading all items before instanciating a SelectMenu, a limit could be
set during the fetch, and another fetch can happen as the user type.

A test has been added to verify that the onInput props is called correctly,
and executes its code. In this test, the list of choices is edited, and we
assert that the newer elements are present in the menu.

closes odoo/odoo#124224

Signed-off-by: Bastien Fafchamps (bafa) <bafa@odoo.com>
2023-06-08 13:10:14 +02:00