Change the command palette shrotcut from CTRL+K to CTRL+M,
in order to avoid conflict with link creation shortcut in editor.
task-2635043
closesodoo/odoo#75828
Signed-off-by: Bruno Boi <brboi@users.noreply.github.com>
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.
closesodoo/odoo#75396
Task-id: 2622952
Related: odoo/enterprise#20447
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
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
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
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.
closesodoo/odoo#74783
Signed-off-by: Bruno Boi <brboi@users.noreply.github.com>
*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.
closesodoo/odoo#74535
Related: odoo/enterprise#20003
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
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.
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.
closesodoo/odoo#73750
Related: odoo/enterprise#19970
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
This makes the debug menu more natural to use, and makes the difference
between the "in-dialog" and "out-of-dialog" debug contexts explicit.
closesodoo/odoo#74346
Related: odoo/enterprise#19967
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
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.
closesodoo/odoo#74148
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit avoids displaying commands associated with the wrong active
element in the palette command.
closesodoo/odoo#74149
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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.
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
closesodoo/odoo#73720
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Before this commit, the modified test sometimes failed on runbot.
We need to wait for an extra tick, because the dialog might be
rendered in another animation frame that the crashing client
action.
closesodoo/odoo#73675
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Since [1], the modified test was failing randomly on runbot. Here
is what happened when it failed:
- the initial action crashed
- we toggled the menu dropdown
- an error dialog was displayed -> the active element changed
- the dropdown was closed (due to commit [1])
- we asserted that the dropdown contained 3 items, but it was
closed, so test failed.
[1] https://github.com/odoo/odoo/commit/300ef9ac6fc92bcfd9c37a6088df650e0af32018
The purpose of this commit is to:
- Improve the design of the command palette
- Add few data-command-category and data-hotkey
- Scrolling through the command palette dropdown with the up/down arrows
should loop
- Moving the mouse over the palette command no longer causes scrolling
Task-2590390
Before this commit, if there was a crash in a view or client
action during an update (i.e. the action is already in the DOM,
but an update triggers a re-rendering), the error was caught by
the action service, it wasn't displayed to the user, and the
action was re-rendered again (which could obviously result in the
same error being thrown again and again).
With this commit, we properly show the error, and we do not try
to re-render the action.
closesodoo/odoo#73507
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
From this commit:
- It is possible to modify the overlayModifier allowing to display the
overlay and to access the data-hotkeys defined in the Dom.
- Adding a hotkey using the service or hook does not add the
overlayModifier anymore.
closesodoo/odoo#73279
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Sergey Shebanin <sergey@shebanin.ru>
Before this commit, when hovering a button with a bootstrap tooltip set on it
(form view with header button in debug mode) and then clicking while staying hover
the tooltip was not destroyed and there was no easy means to destroy it.
After this commit, any click within a legacy context remove any bootstrap tooltip from the DOM,
since popper and tooltip are not meant to be used in the future in a wowl setting.
closesodoo/odoo#73447
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
* google_recaptcha, mail, partner_autocomplete, point_of_sale, website
Now, to read session information, the module "@web/session" must be
imported. Not that, there is also the user service with all the user
information.
closesodoo/odoo#73201
Related: odoo/enterprise#19434
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, two tests had undeterministic outcomes:
they wanted to assert something in DOM was present at the same tiome as an owl rendering
After this commit, the problematic asserts are removed and the tests behave deterministically.
closesodoo/odoo#73379
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Do an action that will change the hash.
During this, change the url hash to load another action
Before this commit, the hash taken to load the second action was wrong, because the first
action pushed its state instants before the hashchange event is actually triggered.
This is because the hashchange event is triggered in a non blocking stack
(https://html.spec.whatwg.org/multipage/browsing-the-web.html#scroll-to-fragid)
After this commit, the right action is loaded with the right hash
closesodoo/odoo#72878
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
* Add test name when logging missing action ids, makes finding out
which test causes the issue much simpler.
* Suppress the warning emission in the one remaining test which
triggers it, as testing invalid action IDs is exactly the purpose of
the test.
This commit adds the possibility to use a shortcut from the command
palette. When a shortcut is called from the command palette, the palette
will be close and the action related to the shortcut will be apply.
closesodoo/odoo#72831
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
on a legacy form view, do an action in target new
The view in target new should, during its onchange, trigger a ValidationError
Before this commit, the dialog_container was stuck in an error loop.
This was because the received error was never an instance of Error, rather it was
a legacy error event. So it was never transmitted upstream were the ErrorHandler could remove
the dialog in error from is dialog array.
After this commit, the ValidationError mesage is displayed.
This commit additionally fixes another issue:
An action in target main that failed to render erased the whole DOM. This is not what we want,
at least for now. Imagine a list view, open a record, this record fails to load. We still want to be
on the list view, not in a blank state.
Open a action in target new that you'll know will fail to open.
Make sure you put an onClose callback when executing doAction.
Open another action in target new, that will succeed.
Before this commit, the onClose of the first dialog is executed, while it should not.
Indeed, if the dialog fails, the whole business flow is invalid altogether
and no more business operation (in the onClose) should be executed
After this commit, the onClose callback of the failing dialog is not executed.
Before this commit the doAction method of the action_service did not support
to pass props directly to the Component. Only a few ad-hoc options were passed though.
After this commit, doAction can take a key "props" in options, that will be passed to the Component
(a View or a ClientAction)
the new API becomes
```ts
interface Options {
props: { [key: string]: any };
...
}
doAction(action: ActionRequest, options: Options);
Note that some props (like withFilters) are set by the action service
and cannot be set via the key "props".
Alongside the change mentioned above, we take the opportunity to align the
terminology used in action service to the one used server side: we know use
the terms resModel, resId, and resIds instead of model, recordId, and recordIds.
```
closesodoo/odoo#72397
Related: odoo/enterprise#19127
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Before this commit, rainbowman message was displayed using
`t-raw` in template.
Now, the message is escaped by default and needs to be marked as
HTML to be displayed as well.
closesodoo/odoo#72392
Task-id: 2575435
Related: odoo/enterprise#19121
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, all actions, even those executed in target
"new" (i.e. in dialogs) updated the document's title. Actions in
dialog should not do that.
closesodoo/odoo#72526
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
The activities systray item didn't work anymore. Nothing happened on
click.
It was because the do action event was never caught. The systray item
logic had a different flow and didn't go through the ViewAdapter code.
We fix this by adding a listener on window (through legacy service
provider) to execute this code when the do_action bubbles up.
Instead of using the legacy service provided, we could have done this
in the SystrayItemAdapter, but we then have the legacy environment and
would need more work for the same result.
closesodoo/odoo#72406
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, the push state from client actions to the URL did
not work properly:
1. the action.params key was ignored
2. some "reserved" keys (active_id) were not handled properly
3. within a legacy client action, the call to parent.do_push_state did not work
After this commit, all of those work properly letting discuss in particular have the right URL
It is worth noting that in the full wowl stack, that the right way to push something
in the URL from a component is always to call the router service's pushState when the component is mounted
closesodoo/odoo#72408
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, an error in the rendering of a client action or view
would not be properly cleaned: the action container did not catch any
error, so owl would destroy the UI.
With this commit, we simply catch the error, and empty the content of
the action container.
Before this commit, the switch from a multiple view (list, kanban, ...)
to a custom form view was not correctly done. The form view displayed
was not the custom version but the default one.
This problem is caused by the filter applied on viewSwitcherEntries
which removes the form views because they are not a multiple view.
To solve this problem, we will add the missing form view in the
actions.views given to the legacy view.
closesodoo-dev/odoo#958
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, effect service provided two functions:
create(type, params)
rainbowMan(params)
Now, it provides one function add which is create but renamed
rainbowMan function can be called by doing:
service.add("rainbowman", ...);
closesodoo-dev/odoo#969
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
The new execution environment of wowl tests has to take into account that legacy objects
can be spawned below it and around it, in particular in mail tests where mail has to create
an owl environment with the right keys.
This commit aims at making this work namely by being to pass an already formed legacyEnv
to the createWebClient helper
In legacy, doAction can be passed the `controllerState` key, which contains `searchModel`
and `searchPanel`, that an AbstractController can export.
This commit re-implements this in the action service.
Some services are coupled with a Component. Usually the service
handles the state of the system, and the Component displays or uses it.
To enable the communication between the service and the component
while making it private, the services should add themselves their
Component in the relevant registry, with the proper means of communication
passed in props.
This mechanism relies on c1d49d494e0ae3a94b3943186eb6d1ebd7b98a6e
Before this commit, menus in navbar and clickable elements on the home
menu were not openable in a new tab through a ctrl-click or through the
middlemouse button.
In order to achieve that, we now use default behavior of <a href/> elements.
As such default behaviour would conflict with <DropdownItem/> clicks,
a global click handler is added in the WebClient constructor which stops
the click event propagation under these specific circumstances
(ctrl-click inside an <a href/> element).
Besides this work, it has been found that the <Dropdown/> root element
should not always be a <div/> as it was, but sometimes it has to be
another HTML element in order to comply with the W3C specs. E.g. a
<Dropdown/> component as a first level child of an <ul/> element must
have a <li/> root element instead of a <div/> one.
Thus, a new prop is added to the <Dropdown/> component (`tag`) allowing
the developer to choose another root element: `<Dropdown tag="'li'"/>`.
closesodoo-dev/odoo#913
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
BUG: Begin on a multi record view (list, kaban), change the url param "view_type" to form. A controller
adapter component would fail to mount and and promise would be pending for ever, freezing the webclient.
WHY: The new webclient, in the specified case described above, would set the recordId to false when switching
to the single record view without providing a record id in the url. However, the legacy views expected a value
of undefined.
FIX: In an adapter layer, the legacy views adapter, we check for the recordId being set to false. When it is,
update this value to undefined.
closesodoo-dev/odoo#933
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
From a list or kanban view, quickly click multiple times on a
record or on the Create button: a lot of bad stuff could happen
from there (e.g. crashes, form view that could not be open
anymore afterward).
The reason was that we destroyed the legacy form view whereas we
shouldn't, as it was still used. In more details, when we clicked
first on a record to open it, we created an owl Component to
instantiate and wrap the form view (legacy). When we clicked a
second time, we another owl Component was instantiated and the
first one was destroyed. As an unwanted side-effect, the legacy
form view was destroyed as well, but the new controller wanted to
reuse it. From that point, anything bad could happen as we were
trying to use a destroyed widget.
closesodoo-dev/odoo#941
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>