Commit Graph
218 Commits
Author SHA1 Message Date
FrancoisGe 6daa9188cb [IMP] web: highlight searchValue in CommandItem
With this commit, when you perform a search in the command palette,
the part of the commandItem's name that matches the searchValue will
be highlighted.

closes odoo/odoo#82407

Task-id: 2741837
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-01-21 09:40:50 +00:00
Achraf (abz) 7c362b0b14 [FIX] web: Infinite loop with datepicker input
Steps:
 - Go into a view and filter on date/datetime
 - Select between
 - change the input max date manually
 - click outside the calendar while remaining in the filter dropdown to "validate" the input
 - infinite loop/crash

Same problem/fix as https://github.com/odoo/odoo/pull/78394 in 14.0

opw-2722797

closes odoo/odoo#83107

X-original-commit: 32e2d88ca0a864c91992b2c522ef21dbcb9787a5
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Achraf <abz@odoo.com>
2022-01-20 17:39:12 +00:00
Julien Mougenot db63ff2259 [REF] web: Owl imports adaptation
In the next version of Owl, all exported terms are directly available
from the top level `owl` object. This commit aims to adapt existing
imports to this new system. This is done by importing any Owl property
used in files at the top, right after the `import` or `require`
statements.

closes odoo/odoo#82736

Related: odoo/enterprise#23609
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-01-20 11:03:01 +00:00
FrancoisGe 91394ed79d [FIX] web: Command Palette FooterComponent
This commit solves a naming error introduced by commit 1e1b45ea62, the name of a component always starts with a capital letter.

closes odoo/odoo#82629

Related: odoo/enterprise#23285
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-01-19 16:52:18 +00:00
Samuel Degueldre 53b7d2a632 [REF] web: stop using component ref in dialog tests
This is in preparation for owl2

Part-of: odoo/odoo#82326
2022-01-18 13:40:30 +00:00
FrancoisGe 1e1b45ea62 [IMP] web: Command Palette footer
This commit will change the setting of the emptyMessage and the
footer of the main command palette.
In order to make the command palette footer more customizable, we will
replace it with a Component. For example, using a footerComponent in the
main command palette allows us to adapt its text based on the namespaces
used.

Setting up an empty message:
Before:
```
registry.category("command_empty_list")
        .add("@", _lt("No user found"));
```
After:
```
registry.category("command_setup")
        .add("@", {
            emptyMessage: _lt("No user found"),
            });
```

With this commit, it is possible to add a namespace to the footer tips:
```
registry.category("command_setup")
        .add("@", {
                name: _lt("channels"),
            });
```

closes odoo/odoo#82541

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-01-12 11:19:00 +00:00
FrancoisGe 52a1d997d2 [IMP] web: custom command palette
This commit adds the possibility to open the custom main command palette.
So it is possible to replace some parts of the default command palette
config.

For example, we will customize the placeholder:
```
    this.command_service.openMainPalette({
        placeholder: "My custom placeholder",
    })
```

This commit also modify the api of CommandPaletteConfig, we replace
namespace by searchValue. Now it is possible to open a command palette
with a value in its input.

For example:
```
    this.command_service.openPalette({
        searchValue: "@test",
    })
```

closes odoo/odoo#81814

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-01-10 13:52:34 +00:00
Samuel Degueldre 0091259e17 [REF] web: remove datetime-changed event in preparation for owl-2
In owl-2, t-on will no longer be supported on components. This commit
converts the code that used to rely on the datetime-changed event to use
a callback-prop based approach instead.

closes odoo/odoo#81199

Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2021-12-20 20:57:13 +00:00
Samuel Degueldre 57a02f0a14 [REF] web: remove dropdown-item-selected event
In owl 2, the t-on directive is no longer supported on components. The
way to handle events on components is to give them a callback as a prop.
This already works in owl 1, so this commit prepares the code for an
easier migration in the future by removing the "dropdown-item-selected"
event and converting the code that was using it to use the new paradigm.

closes odoo/odoo#80684

Related: odoo/enterprise#22722
Signed-off-by: Géry Debongnie <ged@odoo.com>
2021-12-14 12:40:19 +00:00
Samuel Degueldre 671ed63b2a [IMP] web: call methods with correct 'this' in arrow function
Currently, bare method calls in arrow functions in templates are bound
to the rendering context/scope. While this gives you access to most of
the things that exist on the component for reading, writing on 'this'
will not always work, and the rendering context can pollute the
component's name space. This commit fixes that by explicitly calling the
method on the instance of the components.

Part-of: odoo/odoo#80684
2021-12-14 12:40:19 +00:00
FrancoisGe a8222d65e6 [IMP] web: add tooltip on Dropdown
This commit adds the possibility to add a tooltip on a Dropdown.

closes odoo/odoo#81205

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-12-13 13:17:50 +00:00
Samuel Degueldre 7b3b421c4d [FIX] web: rerender MainComponentsContainer on main component error
Previously, when a main component errored during rendering, we would
remove it from the list of main components that should be rendered by
the MainComponentsContainer to avoid it erroring again on a subsequent
rendering (which can cause infinite error loops).

Unfortunately, since we did not rerender the MainComponentsContainer
after this removal, the erroring main component would remain, and could
cause such error loops anyway. This commit fixes that.

closes odoo/odoo#80822

X-original-commit: 0a2fa98086dfdaa36b01ca8ef3e22b8b8ffef60c
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-12-03 09:44:04 +00:00
Samuel Degueldre 431e802e31 [FIX] web: allow patching descriptors with getter/setter with value
Previously, it was impossible to patch a property that was defined with
a getter or a setter with a simple value property. This commit fixes
that.

X-original-commit: cd7514e35b458143a948c7b8e73b05760df0a482
Part-of: odoo/odoo#80543
2021-11-30 12:06:07 +00:00
Samuel Degueldre 35ccfb712e [FIX] web: stop signaling RPC responses on the bus for silent RPCs
When an RPC request is made, we signal it on the bus. This is used,
among other things, to block the UI when the network is unresponsive.
Some RPCs however are meant to be done in the background (eg,
longpolling) and not block the UI as they take a long time by design.

When the response to an RPC arrive, we signal it on the bus so that the
UI can be unblocked. Until this commit, the silent RPCs that never
signaled making an RPC on the bus signal that their response has
arrived, which can cause the UI to be unblocked even though a
non-background RPC was made.

This commit fixes that.

X-original-commit: 695efbfdce200c05b53bc23dc838d81f24589aa3
Part-of: odoo/odoo#80543
2021-11-30 12:06:06 +00:00
Lucas Perais (lpe) c1c5509508 [FIX] web: core: hooks: onDestroyed
Introduce the onDestroyed hook which makes a callback executable
whenever the component is destroyed.

X-original-commit: 0f454392b39dcbc7e297e882117452c5adc342be
Part-of: odoo/odoo#80353
2021-11-25 09:14:01 +00:00
Michael (mcm) 4649d9c0a2 [FIX] web: fix readonly patch._super
Since https://github.com/odoo/odoo/pull/79858,
we define the patch._super with an `Object.defineProperty`.
It works well but it prevents objects from being patched
by the legacy patch method afterwards.

closes odoo/odoo#80317

X-original-commit: 2090e09c51876b9b8af4097ca8f093a8c19361e0
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-11-24 13:17:10 +00:00
Bruno Boi 541e3ef38f [FIX] web: rainbowman effect must always use the RainbowMan component
Before this commit
Calling the rainbow_man effect with a custom component would replace entirely the RainbowMan component instead of passing it a subcomponent to display.

After this commit
It is fixed.

closes odoo/odoo#79962

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-11-19 12:07:54 +00:00
luvi e756d9bc80 [FIX] web: anchor scroll crash
This commit fixes some issues happening when scrolling
with an anchor in Odoo. When the anchor was contained inside
of a notebook and no scrollable was found, a crash happens.
This fix improves the behavior in notebooks by showing the
correct pane before scrolling in form renderer. The scrollTo
util has been improved to remove duplicate lines and handle
multiple situations (0, one or more scrollables). Tests haven
been written to test such behaviors.

closes odoo/odoo#79935

X-original-commit: 4c2b807d1cb32e52a1b1fb5e6c80fb7e933940bc
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-17 13:51:54 +00:00
Aaron Bohy 1bb9cb89c8 [FIX] web: setup luxon locale from user lang
Before this commit, luxon wasn't configured with respect to the
user lang, meaning that months weren't translated (for instance,
in the filter menu, date(time) filter options, or in the datepicker
displayed in the "Add custom filter" sub-drodown).

closes odoo/odoo#79644

X-original-commit: 9530b0a2462aca0938ce315cee262b147b7a5634
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-12 08:25:53 +00:00
Tommy (tong)andAaron Bohy 114a5885ba [FIX] web: rpc error handling: use normal dialog if possible
Before this commit, automated actions could not raise "normal"
errors anymore (e.g. UserError). Indeed, since the wowl refactoring,
it always shows the custom BaseAutomationErrorDialog when an error
is thrown in an automated action, even if it is a standard error
well-known by the framework. Before the wowl refactoring, those
errors were handled normally if possible, and when it wasn't the
case, the custom BaseAutomationErrorDialog was used.

This commit restores that behavior.

Complete steps to reproduce:
- Install base_automation module
- Install an app for the base_automation to trigger (e.g. Sales)
- Turn on debug mode
- Go to Automated Actions
- Create an action with Action To Do is Execute Python Code and the Trigger is On Creation & Update
- Set the model to your app (e.g. SalesOrder)
- Put `raise UserError('Test')` in Python Code section
- Go back to the app, try to create a new record in the model you set for the automated action to trigger
- Compare the result with 14.0

closes odoo/odoo#79611

X-original-commit: d65d742de1b30a00b3ffd872c042e002736f7f6b
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2021-11-10 11:28:15 +00:00
luvi d304be57be [FIX] web: scrolling to anchor working badly
This commit fixes a bug when you clicked on a link related to an anchor.
e.g. an <a> tag with an href="#anchor". The scroll to the element
with id="anchor" didn't happen because the position was not found correctly.
The fix uses getBoundingCLientRect to get more precise positions
of the element with the anchor and the scrollable area.
A test is introduced to check scrolling for multiple anchors in a template
with a more complex structure (Note: the test fails without the fix).
The scroll behaves differently depending if the target is an anchor or
an element. An other test has been added for the command palette about this
behavior.

closes odoo/odoo#79310

X-original-commit: b0da44d62f85d6530f8e568025f7fea25c5454c5
Signed-off-by: FrancoisGe <fge@odoo.com>
2021-11-03 11:48:46 +00:00
Michael (mcm) df72d187e1 [IMP] web: add "unique" array utility function
This commit adds "unique" array utility function which
returns a copy of the given array but without any duplicates.

closes odoo/odoo#76472

Related: odoo/enterprise#20833
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-02 10:45:15 +00:00
Michael (mcm) d1c8a565ab [IMP] web: add pager to new framework
Before this commit, Pager was not implemented in the new framework.

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

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

Part-of: odoo/odoo#76472
2021-11-02 10:45:14 +00:00
Aaron Bohy e3f08513c2 [FIX] web: router: do not push unnecessary entries in history
Before this commit, the router didn't considered as equal an
integer value given as an integer or as a string (e.g. "1" or 1),
whereas form the url point of view, it's exactly the same, and the
information is lost anyway.

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

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

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

closes odoo/odoo#79132

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

closes odoo/odoo#79023

X-original-commit: f5c8e855f07d68a34dccd9977b53999911a66f62
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-26 19:40:51 +00:00
Aaron Bohy f9594fba3f [FIX] web: patch: can call a not bound patched function
Before this commit, it wasn't possible to patch some functions
(e.g. setTimeout) on window, because of the way we call them.
Indeed, we typically do `setTimeout(...)`, because this function
doesn't need to be bound to the window object.

X-original-commit: 476dbf75bb88dc2ddfdd47c1f229ce53cf7fadb7
Part-of: odoo/odoo#78698
2021-10-20 15:15:22 +00:00
Achraf (abz) f04ce9a516 [FIX] web: don't prevent DropdownItem click event if no href
Before this commit
Each click event triggered inside a DropdownItem is default prevented

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

opw-2665795

closes odoo/odoo#78628

X-original-commit: 11760db91fc56fb8b998d77661f8d4d7842f3eb8
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2021-10-19 14:43:50 +00:00
Bruno Boi cc3403ad47 [FIX] web: action context pollution from session storage
Before this commit
An action retrieved from the session storage may not take into account
changes in the user context because the user context is duplicated in
the action context. When the user context changes i.e. through the
switch company menu (allowed_company_ids) and the browser reloads,
the action service will make the action context concatening the new user
context with the context of the action stored in the session storage,
which has still values from the previous user context.

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

closes odoo/odoo#78415

X-original-commit: 7354d1686915ec21437fc677f15a6c5409106492
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-10-14 18:15:13 +00:00
Bruno Boi b710b6d323 [FIX] web: missing test for usePosition hook
The commit a27bbda37f1ad4 did not add a unit test.

Here it is.

closes odoo/odoo#78297

X-original-commit: e3a32191b6b9411abaf4c15550e537c666d615bd
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-13 12:31:02 +00:00
Bruno BoiandSam Degueldre 3594b8cebd [FIX] web: fix crash when dropdown is unmounted quickly
Previously, when quickly mounting then unmounting a dropdown, a
traceback was shown. This is because the usePosition hook registered
listeners that were throttled/debounced, which would be called after the
component was already unmounted, causing the crash.

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

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

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

X-original-commit: a27bbda37f1ad444023cb1aae56675ac6c263cb2
Part-of: odoo/odoo#78261
Co-authored-by: Sam Degueldre <sad@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
2021-10-13 06:03:58 +00:00
Lucas Perais (lpe) 885d105075 [FIX] web: py_js: py_date: relativedelta revive features
Before this commit, absolute notation was not supported.
weekday, yearday and nlyearday were not supported either.
Some other computations did not work, or weren't tested for.

This commit re-introduce the support for all those features.

closes odoo/odoo#77851

X-original-commit: c423326a97060fb9132abcaf997ffba41a63b5fe
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-10-05 14:17:21 +00:00
b63ee52552 [FIX] *: remove scss 'extend' from dropdown components
This commit removes all the 'extend' initially introduced to avoid code
repetition and ensure visual consistency across Bootstrap and Owl dropdowns.

Despite achieving the desired results, using 'extend' in this context
was seriously impacting the bundle generation time, probably due to an
underestimated amount of Apps' legacy-code applied on these elements.

In order to achieve the same results, the chosen strategy is to add
Bootstrap default classes directly into Owl dropdowns.
Also, it moves code related to bootstrap dropdown in 'webclient.scss',
leaving 'core/dropdown/dropdown.scss' for Owl code only.

Due to the discrepancies between Bootstrap and Owl html
structure, the '.dropdown-item' class could not have been added
directly to Owl's '.o_dropdown_item' itself, without refactoring
the Dropdown component structure.

// ==== Bootstrap 4.6 default Structure ================================
<div class="dropdown-menu">
  <button class="dropdown-item" type="button">Action</button>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== OWL default Structure before this commit =======================
<ul class="o_dropdown_menu">
  <li class="o_dropdown_item">
     <span>Action</span>
  </li>
  <li class="o_dropdown_item">
     <a href="#">Another action</a>
  </li>
</ul>

// ==== OWL Structure after this commit ================================
<div class="o-dropdown--menu dropdown-menu">
  <span class="dropdown-item">Action</span>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== web.assets_backend.css Bundle Generation Comparison ============
With all modules installed (enterprise edition over runbot):
Before this commit, bundle took ~2.5s and ~4s to generate and weighted ~322kB (~2.5MB uncompressed)
After this commit, it takes between ~1.2s and ~1.6s and weights ~257kB (~1.6MB uncompressed)

closes odoo/odoo#77649

X-original-commit: 84715436d87bb05b421bc9ccaacda67d07571690
Related: odoo/enterprise#21370
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Stefano Rigano <sri@odoo.com>
Co-authored-by: François Georis <fge@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
2021-10-04 07:57:00 +00:00
Mathieu Duckerts-Antoine da8f749f56 [FIX] web: py.js datetime.timedelta implementation
The identification of timedelta with relativedelta was wrong.

Here we define a class PyTimeDelta used by py.js to evaluate most
expressions in which datetime.timedelta and some operations producing
timedeltas occur.

The class PyTimeDelta allows to:
    - create a timedelta
    - add/substract two timedeltas
    - multiply (divide) a timedelta by a float (resp. an integer);
    - take opposite of a timedelta
    - evaluate equalities between timedeltas and other expressions
    - decide when a timedelta is "false"
    - get total_seconds of a timedelta

In relation with that, we have improved the implementation of PyDate
and PyDateTime to allow most manipulations of datetime.date and
datetime.datetime producing/using timedeltas. It is now also possible to
evaluate equalities between dates/datetimes and other objects.

closes odoo/odoo#77453

X-original-commit: fcd4959a65a92e34ce986575c7fc279c195e9a11
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
2021-09-30 10:38:19 +00:00
Simon Genin (ges) ff6823cb24 [IMP] web: xml parsing doesn't fail silently
closes odoo/odoo#77452

X-original-commit: 58c3a36ee955cb2c3bb461244dd026fd0ab798ac
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2021-09-29 23:57:22 +00:00
Aaron Bohy 800297064c [FIX] web: useTooltip: clearInterval on willUnmount
Before this commit, the useTooltip hooks didn't call clearInterval
when the component using it was unmounted/destroyed. In practice,
it wasn't an issue because the only component using it was the
webclient, and it is never destroyed. However, for this hook to be
usable in other contexts, it is important to remove this leak.

closes odoo/odoo#77113

X-original-commit: d076afd035ad8fadc5a0774c6c0eec15acb15026
Related: odoo/enterprise#21147
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-24 09:45:44 +00:00
Aaron Bohy 9d98d1e870 [REF] web: useTooltip: use template instead of component
Allowing to specify components inside tooltips to obtain dynamic
and/or html content was a bit overkill and unnecessary: a template
can do the trick and it is easier to define.

This commit thus renames attribute "data-tooltip-component" into
"data-tooltip-template" (the name of the qweb template) and
introduces the "data-tooltip-info" attribute (its value is then
available in the template under the "info" variable).

X-original-commit: 8683a8d762339451e3d9f8706aac86da80510b37
Part-of: odoo/odoo#77113
2021-09-24 09:45:43 +00:00
Aaron Bohy 35ac826f94 [FIX] web: effect: display rainbowman by default
In [1], we rewrote the effect feature in the wowl infrastructure.
However, we lost something in the process: the "type" of effect
(basically "rainbow_man" as it is the only implemented effect)
became a mandatory param, whereas before it simply defaulted to
"rainbow_man" when not set. As a consequence, previously defined
effects in views could crash.

This commit fixes that issue, and reworks a bit the feature by
introducing a registry of effects, which easily allows to add new
effects from the outside. An effect is a function that may return
a Component (and its props) to display.

Most of the diff in the tests is about moving files where they
should be (the effect feature being in core/, the tests must be
in core/ as well, and not depend on the webclient).

[1] 0573acae23

Task 2652927

closes odoo/odoo#77109

X-original-commit: 74dc3f654ee5849982b494e46eefb1fc2b4e0c74
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-09-23 20:18:47 +00:00
Mathieu Duckerts-Antoine 99e77f708e [FIX] web: py.js evaluation of current_date
current_date was absent from py_builtin. For that reason, it was
impossible for the search model to evaluate a dynamic domains like
"[('date_deadline', '&lt;', current_date)]"

We add current_date to py_builtin.

closes odoo/odoo#77035

X-original-commit: ade082c5ad9221c82de90ddbe68b814b1487753d
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-09-23 11:26:10 +00:00
Mathieu Duckerts-Antoine 31c9bcaaca [FIX] web: py.js evaluation of to_utc
The class PyDateTime did not have a method to_utc. For that reason, it was
impossible for the search model to evaluate a dynamic domains like
"[('date', '&gt;=', (datetime.datetime.combine(context_today(), datetime.time(0,0,0)).to_utc()))]"

We implement that method.

X-original-commit: 3ad9a3be64da78d596ee3dc435d4b224728a9e76
Part-of: odoo/odoo#77035
2021-09-23 11:26:09 +00:00
Francois (fge) 97733eae50 [FIX] web: fix Edit ControlPanelView
The debug item "Edit ControlPanelView" is only available if there is
a control panel in the current view.

closes odoo/odoo#76862

X-original-commit: 68cb8d23e2011ed359fc54f3deed6c84290d5c3b
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-20 20:14:03 +00:00
Francois (fge) 421a676156 [FIX] web: use makeDeferred from web
closes odoo/odoo#76848

X-original-commit: 2777d187cd72967a1137f851c6c9cc0f9172dcee
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-20 20:13:57 +00:00
Aaron Bohy cc9c229fda [IMP] web: add Race concurrency primitive
This commit adds a new concurrency primitive inspired by
Promise.race, except that it is dynamic (promises can be added to
a Race instance anytime).

X-original-commit: 4a487524d69ac7ede68296ea4e1f51e1b769d642
Part-of: odoo/odoo#76778
2021-09-17 23:59:33 +00:00
Francois (fge) e0e4d38cdd [MOV] web: move /commands to /core
We move /commands to /core because DebugMenu depends
on /command/command_hook. All the files in /commands depend only
on /core or /commands except for menu_providers which we will move to /menus

X-original-commit: eca8cd478b72d81b2293c22d2c9c41d1f94be16a
Part-of: odoo/odoo#76777
2021-09-17 23:59:19 +00:00
Mathieu Duckerts-AntoineandMichael Mattiello cad6408e6e [FIX] web: toJSON for date classes
The classes PyDate, PyDateTime, and PyTime used in py.js to evaluate
python expressions did not have a toJSON method. As a consequence, the
dynamic domains manipulating date/datetime but forgetting to use strftime
didn't work anymore. This fix simply defines a toJSON method in the three
above mentionned classes

closes odoo/odoo#76699

X-original-commit: 53eefe36f39e6c9ad355e78bcabbba4e0039aa35
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
Co-authored-by: Michael Mattiello <mcm@odoo.com>
2021-09-17 11:17:45 +00:00
Francois (fge) 14cbcc07dd [FIX] web: concurrency issue in command palette
Before this commit, if the user searched the command palette and pressed
the enter key without waiting for the rendering, then the command executed was incorrect.

The "inputPromise" promise used to know if the new commands were loaded correctly.
This one did not wait for the resolution "setCommands" called by "onSearchInput".
So we modified the "debouncePromise" utility to make sure that it waits for
the resolution of the function given to it before resolving its promise.

closes odoo/odoo#76613

X-original-commit: 53b905d6993b4e25fec574d92429f2ff91501dfa
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-16 03:40:39 +00:00
Bruno Boi c974b2524c [FIX] web: reintroduce RTL support
With the new OWL view infrastructure introduced by 0134495, some parts of the right-to-left design was broken.

All the issues addressed in this commit are:
- subdropdowns are shown in the correct direction
- subdropdowns' chevrons point to the correct direction
- subdropdowns keyboard navigation with left/right arrows
- popovers' arrows point to the correct direction
- the document's `<body/>` will have the `o_rtl` CSS class

X-original-commit: 8649e46bec051e6bbe21bbdb8023f747206644af
Part-of: odoo/odoo#76444
2021-09-14 06:01:34 +00:00
Bruno Boi 164cb86d2d [FIX] web,mail: various dropdown design fixes
apply new control panel styling from sri
remove o_dropdown_menu_right (looks unused)
remove o_dropdown_inline (this is a regression for small screens, apparently we would like to have this possibility on smaller screens. This does not break mobile usage but Mobile styling is still a bit weird though)
fix systray activitymenu in mobile (issue was introduced with 29731b40)
fix subdropdown flickering (before this commit, parent dropdown was in absolute positioning, making the position hook generate flicker, now it it fixed from the beginning)

Part-of: odoo/odoo#73311
2021-09-07 10:04:39 +00:00
d1e227b07b [IMP] web,*: new PivotView component
Part-of: odoo/odoo#73311
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
2021-09-07 10:04:38 +00:00
Julien Mougenot 42cbcad9c8 [IMP] web: datepicker WOWL
This commit adapts the "old" Owl Datepicker to work with the new Owl
web client. The behaviors have been mostly preserved (i.e. working
with the bootstrap datepicker) and simply adapted to make use of the
new services and registries.

The previous datepicker template and tests have been marked as "legacy".

Part-of: odoo/odoo#73311
2021-09-07 10:04:34 +00:00