Commit Graph
143209 Commits
Author SHA1 Message Date
Simon Genin (ges) 010bbcd9fe [REF] web: errors remove non-needed event
closes odoo-dev/odoo#953

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:33 +02:00
Bruno Boi 47acba560a [FIX] web: open menus in new tab
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'"/>`.

closes odoo-dev/odoo#913

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:33 +02:00
Simon Genin (ges) b124343d21 [REF] web: linting 2021-06-18 21:31:33 +02:00
stefanorigano (SRI) f0ee615290 [FIX] project: scope '.badge' css rules
Prior to this commit these rules were affecting the entire view.

closes odoo-dev/odoo#949

Related: odoo-dev/enterprise#176
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:33 +02:00
stefanorigano (SRI) de188f0224 [IMP] web: extend bootstrap border-radius utility classes
Extend utility classes allowing to use 'sm' and 'lg' variations for
directional border-radius utility classes (eg. 'rounded-lg-left').

The aim is to avoid inconsistencies for all these components that use
custom border-radius values (eg. chatter composer).
2021-06-18 21:31:33 +02:00
stefanorigano (SRI) 843901d1bd [FIX] web: breadcrumb, adaptive 'current entry' color
Adapt breadcrumb 'current' entry color according to its context.
If other entries are visible and clickable, 'current' will be muted
(default). If 'current' it's the only entry, then it acts as view's
title and it will be styled more prominent.
2021-06-18 21:31:33 +02:00
stefanorigano (SRI) 50fc5ff347 [REF] web: switch company menu design 2021-06-18 21:31:32 +02:00
stefanorigano (SRI) 1c5553b032 [FIX] web: o_switch_company_menu position 2021-06-18 21:31:32 +02:00
stefanorigano (SRI) 9a04683602 [FIX] web: nabvar adaptation to handle custom dropdown menus
Prior to this commit, legacy dropdown menus where not targeted
correctly.
2021-06-18 21:31:32 +02:00
stefanorigano (SRI) 40546d777b [IMP] web: checkbox design 2021-06-18 21:31:32 +02:00
stefanorigano (SRI) 3b2cafe363 [IMP] web: ensure tags readability 2021-06-18 21:31:32 +02:00
stefanorigano (SRI) cac131c1e3 [FIX] web_editor: scope '.dropdown-item' css rules
Prior to this commit web_editor custom rules were affecting the entire
bundle.
2021-06-18 21:31:32 +02:00
stefanorigano (SRI) e111cfd35e [IMP] web, *: wcag compliant contextual colors
Overall colors review to achieve WACG standard compliance.
https://www.w3.org/WAI/standards-guidelines/wcag/

Current contextual colors work fine when used for backgrounds but fail
WACG tests when are used for text.
Unfortunately Bootstrap use the same palette in both scenarios without
providing effective control over text colors.

The 'text-emphasis-variant' mixin, indeed, allows to darken a color by a
certain amount, but since the amount is not customizable per-color the
final result is always either too dark or too light for colors that are
not used as a reference.

This commit will define a specif SCSS map called `$o-theme-text-colors`
that mirrors the default '$theme-colors' structure and contain
fine-tuned values to be used specifically for text.

In order to keep the same classes names, we customize the default
'text-emphasis-variant' mixin, instructing it to first look for our
fine-tuned colors and eventually fallback to default.

This commit will also adapt all the modules that use to hardcode text
colors in SCSS rather than using default utility classes. We handle this
using different approaches:

- Use utility classes whenever is possible (eg. 'text-info')
- If apply the class directly is not possible, '@extend' it in SCSS
- If '@extend' is not ideal because of code complexity (eg. ':hover'
  interactions), use the new 'o-text-color([color name])' scss function.
2021-06-18 21:31:32 +02:00
stefanorigano (SRI) 097e726037 [REF] web: date-picker, improve time selection design 2021-06-18 21:31:32 +02:00
stefanorigano (SRI) 490acfcbb7 [IMP] web: control_panel dropdown forms design 2021-06-18 21:31:32 +02:00
stefanorigano (SRI) cfca13199e [IMP] web: dropdown-item design, allow to hide the chevron icon
By default we add a chevron icon before active dropdown menu entries.
In some circumstances it may be misleading, for example when the entry
is not a real option but just toggle for other elements visibility
(eg. control_panel's custom filters).

This commit introduces a new class that, in conjunction with the
'.active' one, will remove the icon while keeping others style rules
untouched.
2021-06-18 21:31:32 +02:00
stefanorigano (SRI) 1fb2cd9af7 [FIX] web, *: drop o_dropdown_toggler_btnclasses
Drop `o_dropdown_toggler_btn` class in favor of `o_dropdown_toggler`.
o_dropdown_toggler_btn was initially introduced in ~13.3, but it's now
obsolete.
2021-06-18 21:31:32 +02:00
Lucas Perais (lpe) bc25afa538 [IMP] web: tests setup: check integrity of legacy global objects
Legacy tests and business code heavily use some global objects (session and _t)
Wowl tests are set to clean the execution environment at the end of each tests
while legacy tests clean their environment when the widget is destroyed

This discrepancy may introduce weird, untimely and virtually undebuggable issues
for the average Joe, because some tests may pollute the execution environment for following tests

This commit aims at limiting this risk by hardcoding a few objects and their field to be checked at the end of each test

closes odoo-dev/odoo#945

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:32 +02:00
Géry Debongnie 12500d8917 [FIX] web: implement missing pyjs operation
The new py interpreter was missing the subtraction of a date with a
relativedelta

closes odoo-dev/odoo#944

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:32 +02:00
Simon Genin (ges) 276228010e [FIX] web: fix legacy views form no id
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.

closes odoo-dev/odoo#933

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:32 +02:00
Aaron Bohy 840f914a4e [FIX] web: concurrency issue when opening form view
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.

closes odoo-dev/odoo#941

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:32 +02:00
Bruno Boi aab6f88439 [MOV] web,base_automation: hotkeys from webclient/ to core/
The hotkeys feature is a core feature, not only useful for the webclient.

closes odoo-dev/odoo#942

Related: odoo-dev/enterprise#172
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:32 +02:00
Aaron Bohy fc7c431840 [FIX] web: actionService: handle async client actions
A client action can be a function. This function may return another
action to be executed afterwards. This function may also be async.
This is for instance the case of the studio client action. Before
this commit, the code handling it directly called doAction with the
promise as action, which could lead to unexpected results. For
instance, studio tours sometimes fail to load the studio client
action.

closes odoo-dev/odoo#935

Related: odoo-dev/enterprise#169
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:31 +02:00
Jorge Pinna Puissant ff20073b21 [FIX] web: use dialog service to close the dialogs
Before this commit, the function close on dialog trigger an event to close
the dialog. This could create an issue when the dialog is not yet mounted.

Now, the function close on dialog uses the dialog service to close the dialog.

closes odoo-dev/odoo#936

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:31 +02:00
Michael Mattiello (mcm) 866f0e8c37 [REF] web: refactor command service API
Before this commit, service command exported 2 functions:
registerCommand and unregisterCommand.

Now, it exports only one function "add" which is calls registerCommand
and returns a callback which calls unregisterCommand
The add function's signature is different from registerCommand:

- registerCommand signature:
registerCommand(command: Command): number
interface Command {
    name: string;
    action: () => void;
    category?: string;
    hotkey?: string;
    hotkeyOptions?: any;
}

- add signature:
add(
    name: string,
    action: () => void,
    options?: Options
): () => void
interface Options {
    category?: string;
    hotkey?: string;
    hotkeyOptions?: any;
}

closes odoo-dev/odoo#923

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:31 +02:00
Michael Mattiello (mcm) 37a73aaf7a [REF] web: change hotkey service API
Before this commit, service hotkey exported 2 functions:
registerHotkey and unregisterHotkey.

Now, it exports only one function "add" which is calls registerHotkey
and returns a callback which calls unregisterHotkey
2021-06-18 21:31:31 +02:00
Bruno Boi 5bd98883ea [IMP] web: focused command gray change
Before this commit, the $o-brand-secondary was way too dark for the web_enterprise version.

Using $o-gray-200 we now ensure the gray difference between community and enterprise is thin.
2021-06-18 21:31:31 +02:00
Samuel Degueldre ad9a322a76 [IMP] web, iap: introduce odoo.info.isEnterprise and use it 2021-06-18 21:31:31 +02:00
Samuel Degueldre 4e7187bba0 [REF] iap: adapt include on CrashManager
In iap, we want to handle InsufficientCreditErrors in a special way
(present the user with a prompt to buy more credits) instead of the
usual error handling that shows a crash dialog. Previously, this was
done by doing an include on the crash manager. In wowl, we no longer use
the crash manager in the backend, and replaced it with an error service
that allows developpers to register error handlers for these kinds of
use cases.

This commit adapts what was previously an include on the crash manager
by instead adding a handler to the error handler registry, the file has
also been renamed accordingly.

The file iap_credit.js has also been removed, as it adds an action to
the action registry that is no longer called by anything, and is dead
code.
2021-06-18 21:31:31 +02:00
Mathieu Duckerts-Antoine 9c05de391e [IMP] *: remove makeFakeUIService helper
The behavior of some components like the Dropdown component depends on the ui service that records
(among other things) what is the "active" element in the page. For instance a dropdown can close/stays open under
certain circumstances if it is in the active element or not. The fake ui service created by makeFakeUIService
was not managing properly the active element. Since we want to avoid code duplication and that there was no real
need for a fake ui serice, we simply drop the helper makeFakeUIService and use the real ui service everywhere.
2021-06-18 21:31:31 +02:00
Samuel Degueldre 99eb5760dd [REF] pos: adapt include on CrashManager to use errorService instead
closes odoo-dev/odoo#931

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:31 +02:00
Samuel Degueldre 6bbf814779 [REF] base_automation: convert error dialog to wowl
closes odoo-dev/odoo#924

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:31 +02:00
Samuel Degueldre 83781d3de5 [FIX] web: empty SERVICES_METADATA when clearing the services registry
Previously, we added the option to declare service methods as async so
that we can protect them from resolving their promise after a component
has been destroyed. To that end, we have created a SERVICES_METADATA
object to hold this data. However, due to an oversight, these metadata
were not being saved and cleared before tests, and restored after,
causing issues when add a mock service that does not expose all methods
exposed by the real service.

This commit fixes that.
2021-06-18 21:31:31 +02:00
Lucas Perais (lpe) 8a530b153b [IMP] web: debugManager: re-implement "Open view" 2021-06-18 21:31:31 +02:00
Jorge Pinna Puissant 5437fb98ca [IMP] web: close action service dialog using the 'x' button
Until now, if a dialog was opened using the action service with an
on_close callback, this callback wasn't called if the dialog was closed
without using the action "ir.actions.act_window_close".

Now, the on_close callback is called after the dialog is closed.

closes odoo-dev/odoo#929

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:31 +02:00
Aaron Bohy b86a26f892 [FIX] web: adapt debug manager profiling
This commit applies [1] in the wowl branch, since [1] has been
developped in parallel of the conversion of the webclient in owl.

Note that the former implementation is still temporarily used on
the website, as it still uses the legacy DebugManager.

[1] 4c4a740e0a

closes odoo-dev/odoo#930

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:31 +02:00
Jorge Pinna Puissant 774ca5571a [FIX] web: close, already closed dialog
Before this commit, when trying to close an already closed dialog, an
error is raised.

closes odoo-dev/odoo#928

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:30 +02:00
Jorge Pinna Puissant 22bb866588 [REF] web: move parseMonetary to currency
closes odoo-dev/odoo#926

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:30 +02:00
Michael Mattiello (mcm) 41e5435d97 [REF] web, *: refactor notification service
* bus, calendar

This commit changes the notification API and adapts codes that use it
Notification API before:
    - create(...): number
    - close(id: number, wait?: number)

Notification API now:
    - add(...): RemoveCallback

closes odoo-dev/odoo#908

Related: odoo-dev/enterprise#158
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:30 +02:00
Michael Mattiello (mcm) 2384ebc689 [REF] web: refactor popover
This commit refactors the popover to make it imperative.
Popover cannot be used in templates anymore.

closes odoo-dev/odoo#914

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:30 +02:00
Géry Debongnie f4bb46cd29 [REF] web: update systray registry to take Component/props 2021-06-18 21:31:30 +02:00
Aaron Bohy 2e2d6a166e [IMP] web: userService: add hasGroup function
This commit adds the 'hasGroup' function to the user service. This
function holds a cache s.t. we never do twice an rpc for the same
group. This is the equivalent of 'user_has_group' in session, in
the legacy codebase.
2021-06-18 21:31:30 +02:00
Aaron Bohy a5091fee99 [REF] *: rework webclient test helpers
This commit splits the 'getActionManagerTestConfig' helper into 2:
'setupWebClientServiceRegistry' and 'getActionManagerServerData'.

The first one is now automatically called by the 'createWebClient'
helper, as it properly setups the service registry with all services
required by the WebClient component.

The second one generates a few data (menus, actions, views...) that
can be used in tests. That helper is mainly useful for action tests
(formerly ActionManager tests) in web. With this refactoring, they
are no longer generated for each test in the whole codebase that
spawns a webclient, as before this commit.

closes odoo-dev/odoo#906

Related: odoo-dev/enterprise#161
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:30 +02:00
Aaron Bohy dd489c34e7 [IMP] web: qunit: better log failing modules 2021-06-18 21:31:30 +02:00
Samuel Degueldre 40fbbe2b52 [IMP] web: make startServices promise reject when missing dependencies
Previously, the promise returned by startServices was resolved when some
services were missing dependencies. The rationale was that those
dependencies could be fulfilled by bundles that might be in the page
later.

This rationale ignored the fact that bundles or scripts that are in the
same page will be executed in the same microtick.

This commit changes the returned promise from startServices such that it
will throw if after all services that were registered in the registry at
call time that could be started are started, and there are still
services registered that could not be started for lack of dependencies.
2021-06-18 21:31:30 +02:00
Jorge Pinna Puissant 60d3f7400b [IMP] web: add is_system on the mocks
closes odoo-dev/odoo#909

Related: odoo-dev/enterprise#157
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:30 +02:00
Simon Genin (ges) b08267a085 [IMP] web: improve stack name for debounce and throttle
closes odoo-dev/odoo#915

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-06-18 21:31:30 +02:00
Bruno Boi 1cec4e0888 [IMP] web: allow user to select multiple company
Before this commit: when user selects company from company switcher, page is
reloaded, what if user wants to select multiple companies from dropdown, he
have to wait for page reload and need to do same process again.

After this commit: when user selects company from company switcher, page
will not reloaded as soon as user toggles checkbox, user will given time to
select another item or unselect other item from dropdown, so user can select
multiple companies or unselect multiple companies.

task-2467747

closes odoo-dev/odoo#875

Related: odoo-dev/enterprise#148
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:30 +02:00
Bruno Boi 8fcdcc0b1c [REF] web: extract company service from user service 2021-06-18 21:31:30 +02:00
Géry Debongnie 1b549bddd1 [REF] web: improve main_component registry API to accept props
closes odoo-dev/odoo#910

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-18 21:31:30 +02:00