Commit Graph
108 Commits
Author SHA1 Message Date
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
Laurent Stukkens (LTU) 9ffb0143d0 [FIX] web: order company by their sequence in the company switcher
As JS is not taking the properties in the order they are written,
the order in the rendering was always following the property name
sorting order (=id).

Previous to this commit:

    - The companies were ordered by their id in the company switcher as
      JS is not tacking the object properties order into account.

After this commit:

    - The companies will be sorted by their sequence prior to be used in the
      rendering.

task-2722235

closes odoo/odoo#81893

X-original-commit: 39c678a1ccb50d3a1871a4049a8df26427b27a3c
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2021-12-24 12:25:01 +00:00
Yolann Sabaux 49e6abe0b7 [FIX] web: no trigger of an onchange
Steps to reproduce:
- Install Argentinian Electronic Payment (l10n_ar_edi)
- Change company (ar responsable)
- Go in Accounting > Settings: in the AFIP section
- delete key and certificate
- click on `generate request`
-> the key is not persisted unless a manual refresh/discard is done

Solution:
In V14 the `onchange` is triggered. Why?
Because this https://github.com/odoo/odoo/blob/1723c52d42389a8b5124ab4d15d55dad0d119a8f/addons/web/static/src/js/chrome/action_manager.js#L130-L139
works because of the call of the `on_close` function:
https://github.com/odoo/odoo/blob/1723c52d42389a8b5124ab4d15d55dad0d119a8f/addons/web/static/src/js/chrome/action_manager.js#L534-L543

Why not in V15?
In V15 the onchange can be triggered when the `this.reload` function is called via the `on_closed` function:
https://github.com/odoo/odoo/blob/7ce6d8d70be79c9c626865598b898dce9a18b045/addons/web/static/src/legacy/js/views/basic/basic_controller.js#L472-L482

But to be triggered, in the `wrapSuccessOrFail` (when the `_trigger_up` funciton is called), the `onClose` must be called:
https://github.com/odoo/odoo/blob/fb3878b581b831c13550d40e38a8e8890d82ea0d/addons/web/static/src/legacy/action_adapters.js#L362-L376

In order to do that, we would have to use the `options` (the `params`) sent with the `doActionButton` in the `doAction` function.
https://github.com/odoo/odoo/blob/fee371be291ba3d6f1adc71c08420b6510fdf386/addons/web/static/src/webclient/actions/action_service.js#L1198-L1199

BUT the `options` are not used anymore when `_executeActURLAction`* is called (only the `action`paramater is required):
https://github.com/odoo/odoo/blob/fee371be291ba3d6f1adc71c08420b6510fdf386/addons/web/static/src/webclient/actions/action_service.js#L1098-L1104

Therefore, we find ourselves in a situation in which we cannot call the `on_closed` function in (the `options` are not even an 'option'**):
https://github.com/odoo/odoo/blob/fee371be291ba3d6f1adc71c08420b6510fdf386/addons/web/static/src/webclient/actions/action_service.js#L748-L764

Look again in V14 how the function is called:
https://github.com/odoo/odoo/blob/1723c52d42389a8b5124ab4d15d55dad0d119a8f/addons/web/static/src/js/chrome/action_manager.js#L527-L543

The solution is therefore easily understandable.

*we are in this specific switch_case because the action executed is
https://github.com/odoo/enterprise/blob/6805d2f591237ad17d7db827dcf6fe36c2c2744f/l10n_ar_edi/models/res_config_settings.py#L32
** no pun intended

OPW-2680841

closes odoo/odoo#81881

X-original-commit: cb9dfe107d073aeaf4a6b72818b4c28b11dab0c7
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-12-24 10:42:44 +00:00
Aaron Bohy 0376a259e5 [FIX] web: ActionService: send user context to /web/action/run
Since commit [1], the user context wasn't put in the context
sent when executing a server action (only the context of the
action sent). This commit fixes the issue.

[1] 7354d1686915ec21437fc677f15a6c5409106492

closes odoo/odoo#81552

X-original-commit: fee371be291ba3d6f1adc71c08420b6510fdf386
Signed-off-by: Géry Debongnie <ged@odoo.com>
2021-12-16 19:12:37 +00:00
Mathieu Duckerts-Antoine ace9f6c2da [FIX] web: action group_by of type string
Before this commit, an action group_by like "subscription_id" was accepted
in production mode but would make crash a view that uses the WithSearch
component as soon as the dev mode is activated. Here we fix the
problem by making the acion service process the action group_by in order
to make it pass the validation.

closes odoo/odoo#81306

X-original-commit: ea209f126c57ea2f3e456a9b459dd46fd78fc33a
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-12-13 13:17:58 +00:00
Mathieu Duckerts-Antoine c862c8097b [FIX] web: search view after url loaded
Load an action with a list view with at least one record and open the
view form for a record. Then reload the page and go back in the breadcrumbs.
In desktop mode, one arrives at a list view again.

Before this commit, the search view was not correctly initialized.
The problem was that the list view reuse a globaState prepared by the
form view that contains a search model state that do not reflect the
search view arch (the form view does not use the search view).

We fix that problem by preventing the form view to install the
ControlPanelModelExtension. In that way, the form view does not export
a search model state in the globalState and the list view correctly
process the search view arch.

Task ID: 2697084

X-original-commit: 40e04695ef0de96df8b850fac3f7d165585d466a
Part-of: odoo/odoo#81306
2021-12-13 13:17:58 +00:00
Aaron Bohy f3e71d01ee [REF] web: rework env.config
The motivation of this commit comes from breadcrumbs.

Breadcrumbs work as follows: for each controller in the stack of
the ActionService, there is an entry in the breadcrumbs. Except
for the last entry (which corresponds to the currently displayed
controller), the value to display is computed by the ActionService
and stored in this.env.config.breadcrumbs. For the last entry,
we use the displayName set in this.env.config.

When a view wants to update its displayName (e.g. the form view
when we switch to another record), it updates the displayName in
the config, which thus correctly updates the breadcrumbs. However,
this doesn't change the internal values in the ActionService, so if
another controller is stacked over the current one, the penultimate
entry is wrong. To update the internal state of the ActionService,
the event 'controller-title-updated' must be triggered as well,
which is cumbersome. Note that we don't really face the issue yet
because among already converted views, none of them need to update
its displayName in the breadcrumbs.

This commit aims at uniformizing the way the (n-1) first entries
and the last one behave, by making the "breadcrumbs" key encode
all breadcrumbs entries (the n-1 first ones, and the last, current
one). We also replace the "displayName" key by "getDisplayName"
such that it uses a single source of truth, located in the
ActionService, and we provide a function "setDisplayName" to update
it. Finally, this commit introduces the notion of "default config"
which ensures that standalone views, or views in tests, have a
valid config with expected keys.

closes odoo/odoo#81031

Related: odoo/enterprise#22799
Signed-off-by: Géry Debongnie <ged@odoo.com>
2021-12-13 12:24:50 +00:00
Aaron Bohy 2cdd30d61a [FIX] web: breadcrumbs of stacked, legacy client actions
Let's suppose a legacy client action that can be opened from
another action, s.t. it is stacked on it. Before this commit,
the breadcrumbs was incorrect in that client action, as it only
displayed the part of the client action itself, but not the
history. This commit fixes the issue.

Part-of: odoo/odoo#81031
2021-12-13 12:24:49 +00:00
Aaron Bohy 3fa70eed13 [FIX] web: correctly set window title in wowl views
The name of the action is supposed to be displayed in the second
part of the window title (e.g. "Odoo - Partners"). Before this
commit, this wasn't the case for views that were converted to
wowl (only legacy views correctly updated the window title).

Part-of: odoo/odoo#81031
2021-12-13 12:24:49 +00:00
Samuel Degueldre ed80461b66 [FIX] web: stop unblocking the UI on RPC response indiscriminately
Previously, when an RPC response came back, we would unblock the UI. The
goal of this was to unblock the UI that was previously blocked by a
pending RPC. The problem was that we would unblock the UI even if we
never blocked it (as we wait three seconds before blocking the UI). This
could cause the loading indicator to unblock the UI that was blocked by
unrelated code.

This commit fixes that by only unblocking the UI in the loading
indicator if the loading indicator actually blocked it previously.

X-original-commit: 654688a9d07890ff3e80f2eff07e5de87a5f1334
Part-of: odoo/odoo#80543
2021-11-30 12:06:06 +00:00
Lucas Perais (lpe) 73cf808201 [FIX] web: legacy compatibility: transmit all props to the action
Make a legacy widget trigger a do_Action with `this.do_action`
in the options, pass the usual options for the doAction itself plus a props object in it.

Before this commit, the action did not receive all the props.

After this commit, it does.

closes odoo/odoo#80450

X-original-commit: 6607244762355377ac4532302d15dac20a99f79f
Related: odoo/enterprise#22552
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2021-11-29 14:55:28 +00:00
Lucas Perais (lpe) 2991b53511 [FIX] web: webclient: navbar: resize ignored when navbar is detroyed
X-original-commit: 7fbbdefc0e4951959c5000c471d50a01481392a8
Part-of: odoo/odoo#80353
2021-11-25 09:14:01 +00:00
Lucas Perais (lpe) f8920c8078 [FIX] web: webclient, action_adapters: change tab title whenever a push state occurs
From a list view with multiple records, go on a record of that list
Click on the pager next button

Before this commit, the browser tab's title was not updated to the second records.

After this commit, it is.

closes odoo/odoo#80346

X-original-commit: 3d27b739a3e8243d50e9764000727b31727dc2d2
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-11-25 09:13:54 +00:00
FrancoisGe a8cd4e9315 [FIX] web: Breadcrumb to FormView
Before this commit, going to a form view using the breadcrumb menu did
not retrieve the record id. The record id was not present in the url.
So, if you reloaded the page, the record was not displayed anymore.

closes odoo/odoo#80174

X-original-commit: 3eeaa6b1c6f54be9a87e67140ab57fe8f3a61407
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-11-22 14:48:00 +00:00
Simon Genin (ges) a79ab876af [FIX] web: report client action can keep context on reload.
Report client action can need context data to be properly be
displayed. But because all the required data is not put in the url,
reloading didn't work.
However, there is the current action data kept in the session storage
which is a solution to avoid the described problem. But it didn't
work because of the implementation of the report client action execution.
It was in reality executing two actions: one for the report, gathering
the data and fallbacking to a client action. By doing this, the
session storage would not have the necessary data kept for reloading the
page.

The fix is simply to duplicate the code of the client action execution
instead of calling doAction again.

closes odoo/odoo#79567

X-original-commit: 3fc095c57888e5f69729e1a5a6edea97c4c098b6
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-09 14:46:33 +00:00
Michael (mcm) 13686e0e19 [IMP] web: http service in webclient test helper
Before this commit, `setupWebClientServiceRegistry` didn't use
http service but some tests need it.

Part-of: odoo/odoo#76472
2021-11-02 10:45:15 +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
Bruno Boi 39777c9039 [FIX] web: always add usercontext to legacy action
In the new web client architecture, the user context is added to server
requests through the ORM service and is therefore not needed in the
action context. Thus the commit 7354d16 has removed it from the action.

Before the new webclient architecture, the user context was always
prepended to the action context. So this commit reintroduces it for
the legacy views and client actions through their proper adapters.

closes odoo/odoo#78685

X-original-commit: 7975674166a3d8fa9cd8714adab769a7fd681368
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Bruno Boi <brboi@users.noreply.github.com>
2021-10-20 11:44:58 +00:00
Bruno Boi 8687a220b7 [FIX] web: do not keep additional context in stored action
Before this commit
The current action is stored in the session storage with its evaluated
context. This design is wrong because a context is by definition
contextual which means it has to be evaluated at the last possible
moment to ensure it reflects the most recent context.

After this commit
The current action is now stored in the session storage it its most
original state. This is sufficient as in any case actions go through
the doAction method which evaluates the context right before applying
the action logic.

X-original-commit: 2533d47a1d312907389fb85af83f8812c402a609
Part-of: odoo/odoo#78685
2021-10-20 11:44:58 +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
Mohammed Shekha 49b35e85ca [FIX] web: do not clearUncommittedChanges for function actions
Before this commit: In res.config.settings form view when user change something
in form and click on button in form then it will display to save the unsaved
changes, when we click 'Save' button from dialog still dialog remain there
it is not closed(while record is saved in background, just dialog is not closed)

This is because we called 'clearUncommittedChanges' method before executing
client action, 'Save' button on dialog returns client action for reload page
but as we calling 'clearUncommittedChanges' so it will call 'canBeDiscarded'
method of 'BaseSettingController' which again show dialog for unsaved changes.

After this commit: unsaved changes dialog is closed on clicking 'Save' button
from dialog, we called 'clearUncommittedChanges' method only if clientAction is
instance of Component, i.e. if client action is type of function which is our
case, reload is client action which type of function so in that case we do not
need to call 'clearUncommittedChanges'.

task-2662302

closes odoo/odoo#78035

X-original-commit: 5d8376a8f9a8957112afb35854bdb8b050bd6903
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-08 06:09:41 +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
Julien MougenotandAaron Bohy 5bcf16311a [IMP] web: View layout
This commit introduces a new component: the layout component.
Its purpose is to make abstraction of most generic components and
classes when writing a view template or an action.

To make use of this component, we also needed a new system to pass slot
from the parent of the layout to the control panel. This was done in a
hacky way and is meant to be replaced as soon as Owl provides a built-in
way to pass slots.

The control panel has also been slightly tweaked to default its props
from an environment's newly introduced key: the 'config'. This has been
done to reduce the amount of props passed to the layout and search
subcomponents.

X-original-commit: 3b29dd230acd961a72fb0cb971f9363958f65b60
Part-of: odoo/odoo#77463
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
2021-09-30 10:38:29 +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
36988d0edc [IMP] *: use new dropdown in legacy too
This commit replaces the control panel dropdowns with the new <Dropdown/> component, in order to get consistent through the new/legacy views (because the current Odoo version is in a state where some views uses the new infrastructure and some others are still not converted - see odoo/odoo#73311).

The diff seems massive, but it is mostly due to tests adaptations.

closes odoo/odoo#77001

X-original-commit: d679cd0d8ba9a2420e81a42a698763e9be2327e1
Related: odoo/enterprise#21077
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2021-09-23 07:17:43 +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
Francois (fge) e13c41a45f Revert "[FIX] mail,web: Change command palette shortcut"
This reverts commit 2623b4591d.

The command+m shortcut on safari is not listenable. Safari prevents to
catch events of some shortcut reserved for OS actions. Command+m is
used to minimize the app. This makes it impossible to open the command
palette on safari. So we decided to use again the command+k (ctrl+k)
to open the command palette.

X-original-commit: ca0e37cc20da907d74245e935416d66a52976c5e
Part-of: odoo/odoo#76614
2021-09-17 12:38:57 +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
Aaron Bohy 6e4790ad66 [REF] web,board: rename some useSetupAction params
exportLocalState -> getLocalState
exportGlobalState -> getGlobalState
saveParams -> getContext

Moreover, the last one no longer returns an object with a "context"
key, but rather directly returns the context itself.

closes odoo/odoo#76576

X-original-commit: 12111f114c096c50adbb87cea9f1dd97dc16c47d
Related: odoo/enterprise#20894
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-09-15 15:22:25 +00:00
Lucas Perais (lpe) 2869b0b54b [FIX] web: executeReportAction correctly pass the context
Before this commit, the context given to the client action report was incorrect
and produced a crash server-side.

After this commit the context is correctly given to the ReportAction and to the print

closes odoo/odoo#76319

X-original-commit: 43d0ed37cfd1a6a09e7d21976816f4216e94fa6a
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-09-10 13:42:01 +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
aeb8e49972 [IMP] web,*: view infrastructure
We refactor the action service and allow the legacy and new views to share
a global state within a same action.

We introduce two new components View and WithSearch along with
the search infrastructure: ControlPanel, FilterMenu,...

Part-of: odoo/odoo#73311
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: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@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>
Co-authored-by: Stefano Rigano <sri@odoo.com>
2021-09-07 10:04:35 +00:00
Mathieu Duckerts-Antoine e0294887ec [REF] web: debug manager
We refactor some items in the debug registry. In particular, we want to
make them usable in the legacy and new contexts.

Part-of: odoo/odoo#73311
2021-09-07 10:04:33 +00:00
Mohammed Shekha fff859a946 [IMP] web: display html notification
With this commit we passes messageIsHtml as a prop while calling notification
service when links is available, so that if message has html content then it is
displayed well formatted.

For example: Inventory -> Operations -> Replenishment -> click 'Order Once' button
it will show notification but the link is displayed as string like <a href=.../>
if message has HTML then it should properly displayed.

task-2591451

closes odoo/odoo#74571

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-09-07 06:51:19 +00:00
Sébastien Geelen (sge) 2623b4591d [FIX] mail,web: Change command palette shortcut
Change the command palette shrotcut from CTRL+K to CTRL+M,
in order to avoid conflict with link creation shortcut in editor.

task-2635043

closes odoo/odoo#75828

Signed-off-by: Bruno Boi <brboi@users.noreply.github.com>
2021-09-02 03:42:51 +00:00
Francois (fge) aa797792ca [IMP] web: menu providers command in command palette
Adds the possibility to search an app/menu from the command palette .
It allows for fuzzy-searching apps and their submenus as shortcuts to directly
enter the right app and submenu and execute the corresponding action.

The comamnd is initiated by typing "/" in the command palette.

closes odoo/odoo#75396

Task-id: 2622952
Related: odoo/enterprise#20447
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-08-30 13:27:58 +00:00
Francois (fge) dca9ca6464 [IMP] web: refactor debug commands
Rename `Debug Menu` => `Debug tools...`
Remove `Debug tools...` hotkey

The commands in the debug category need to have a search value
to be displayed.

Task-id: 2622240
Part-of: odoo/odoo#74933
2021-08-26 13:56:14 +00:00
Francois (fge) 8b856c6699 [IMP] web: refactor command palette
This commit is a refactoring of the command palette. It aims to improve
its design and make it very easily configurable. For this, we added the
config props allowing the command palette to know what to display.

The config of a palette command is composed of:
- categoriesByNamespace?: list containing all categories according
  to their namespace;
- emptyMessageByNamespace?: dictionary having for key a namespace and
  for value the message to display if there is no choice available;
- footerTemplate?: template to display in the footer;
- namespace?: namespace to add in the search bar;
- placeholder?: placeholder of the searcher;
- providers: list containing all the providers generating the commands
  to display;
The providers are the only information needed in the config. The rest of
the config is optional.

This commit also adds the possibility to open a custom command palette
using the command service. For this, you just have to call openPalette
and give it the required config.

If the command action returns a config, the command palette  will
not be close and will use this new config.

Task-id: 2622240
Part-of: odoo/odoo#74933
2021-08-26 13:56:14 +00:00
Francois (fge) aa12e9853e [IMP] web: improved api of commands generated by a provider 2021-08-11 08:38:10 +00:00
Bruno Boi 0bb93b272c [FIX] web: various dropdown style issues
Various styling fixes.
Issues were brought by odoo/odoo@3b73095302

closes odoo/odoo#74752

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-08-10 12:58:02 +00:00
Aaron Bohy f6c57577fd [FIX] web: correctly put load_views rpc result in cache
In the "view" service, there is a cache s.t. we don't do the
load_views rpc each time we enter an act_window action. However,
before this commit, we never did cache hits because we modified
(in place) the "views" key inside the action, which is used to
generate the cache key.

closes odoo/odoo#74783

Signed-off-by: Bruno Boi <brboi@users.noreply.github.com>
2021-08-06 11:48:10 +00:00
Aaron Bohy ff6e89052d [REF] web,*: regroup custom hooks in core/utils/hooks
*base_automation,iap,im_livechat,point_of_sale

This commit introduces a new file in core/utils: hooks.js
This file contains custom hooks (useEffect, useService, useBus...).

The useHotkey hook is tightly related to hotkeys, so it has been
moved to core/hotkeys.

closes odoo/odoo#74535

Related: odoo/enterprise#20003
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-08-02 11:13:52 +00:00
Lucas Perais (lpe) 83eb9f9ebd [FIX] web: action_service: onClose callback can execute history-back
Have an action in the breadcrumb (A)

Do an action (B) that has a button which spawns a dialog with a onClose callback executing an`history-back` event.
This may be useful when the action (B) acts as a selection buffer between (A) and the dialog.
(e.g. stock_barcode: execute `stock_barcode_client_action` from a picking)

Before this commit, the history-back event just closed the dialog without going back to the action (A)
This was because the wrong condition was used to determine if the dialog was still alive or not.

After this commit, the action (A) is displayed when closing the dialog from any point.
2021-08-02 07:55:52 +00:00
Francois (fge) bfa2d9c205 [IMP] web: refactor Command palette
The purpose of this commit is to make the palette command customizable.

From now, it will be possible to add spaceNames to modify the commands
displayed in the command palette.
For example, if I add the spaceName '@' and associate a provide function
with it, then when I type "@" in the search bar of the command palette,
the commands generated by provide will be displayed.

const commandProviderRegistry = registry.category("command_provider");
commandProviderRegistry.add("example", {
	nameSpace: "@" ,
    provide: (env, options = {}) => {
        return [{name: "myCommand", action: () => ()}]
    },
});

It will be possible to define several provide functions for the same
namespace. This will make it easy to add new commands when installing
a new addon.

Now it is possible to define commands that modify the state of the
command palette. This allows a command to change the placeholder
and commands displayed in the command palette.

closes odoo/odoo#73750

Related: odoo/enterprise#19970
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-07-30 08:26:09 +00:00
Samuel Degueldre 4c7ef96974 [REF] web: refactor debug menu to use context in env instead of service
This makes the debug menu more natural to use, and makes the difference
between the "in-dialog" and "out-of-dialog" debug contexts explicit.

closes odoo/odoo#74346

Related: odoo/enterprise#19967
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-07-30 06:01:42 +00:00
Samuel Degueldre 1eeab1e418 [REF] web: remove legacy rainbowman
The frontend code was still using the legacy RainbowMan, with the wowl
webclient, we rewrote this RainbowMan and started using that one
instead, but because the frontend code had no access to the wowl
environment, the legacy version was still used in the frontend. Since
the frontend now has access to the wowl environment, the old code can be
removed and the calls can go through the new effect service.

closes odoo/odoo#74148

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-23 12:14:10 +00:00
Francois (fge) b3de6f43d5 [FIX] web: display commands in the palette command
This commit avoids displaying commands associated with the wrong active
element in the palette command.

closes odoo/odoo#74149

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-23 09:50:28 +00:00
Francois (fge) 55dab0e7d1 [IMP] web: use of a default OS for tests
The purpose of this commit is to have a test environment
that does not depend on the OS of the machine
on which the Odoo server is deployed.

Because the navigator.platform is deprecated, we will use the
navigator.userAgent to identify the OS.
2021-07-19 09:07:09 +00:00
Samuel Degueldre 61dd61b6eb [FIX] web: avoid pushing state when ActionAdapter is in dialog
Previously, push_state events triggered from withing window actions
inside dialogs would bubble push their state into the URL even while
within a dialog, this is undesirable as this can cause the URL to become
invalid (eg by pushing the id of a record from an entirely different
model)

This commit fixes that by simply checking whether we are in a dialog
within the adapter before calling pushState.

task-2602458

closes odoo/odoo#73720

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-07-15 08:38:47 +00:00