This commit adds two utility components:
- NotUpdatable: a component meant to be used when a component does not
depend on anything from its parent, so it should not be rerendered
whenever the parent is updated. This is an optimization.
- ErrorHandler: a component that provides a nice way to catch errors
in the rendering for a sub component
We add in this commit a "decorator" to make components that do not
rerender when their parent is updating them. This makes sense for some
main components that knows before hand that they do not depend on a
props change.
This commit is mostly an optimization to avoid useless work by owl, but
it also has some interesting properties: before this commit, each
dialogs would be rerendered whenever a new dialog is added. This could
be an issue if the rendering of one of them causes an error, which needs
in turn to add a dialog, ...
closesodoo-dev/odoo#970
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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>
That way, we ensure that all synchronously defined services are
added to the registry, i.e. if a service depends on another one,
its dependency is present, regardless the order they are added to
the registry.
Closesodoo-dev/odoo#967
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>
- move dialog state handling in dialog service
- remove use of __destroy calls in dialog container
closesodoo-dev/odoo#964
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit makes the confirm callback optional in ConfirmationDialog
It also adds an AlertDialog which can warn the user by simply passing some body text
QUnit's before and after hooks should not be used as they are triggered at the end of a QUnit's module
So that tests within that module would have side effects on one another
This commit changes those hooks to use beforeEach/afterEach so that each test has its own execution environment.
Before this commit, when a test had multiple o_dialog_container elements (the one where we put the
actual modal), a legacy dialog was appended multiple times in the DOM messing around with the test
After this commit, we force dialogs to append once by selecting the first container it finds
In the new mockServer, we add a name to a view (field name on ir.ui.view) when the found view in `fieldsViewGet`
has an id.
In tests data, one would normally specify default views like
```js
views = {
"partner,false,form": `<form></form>`,
}
```
In this case and from the point of view of the business code, the view doesn't really exist in DB
On the contrary, if a developer writes, in a test:
```js
views = {
"partner,999,form": `<form></form>`,
}
```
The returned view from load_views will return that view with ID 999 and, from the business code standpoint, the view would exist
in DB. This is particularly important in studio when it has to fetch a x2m view when none has been inlined in the main view.
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
Before this commit, the props `message` given to a notification was defined as being a String
This is unsufficient as the lazy translate function (_lt) is not technically a String but must be
considered as such.
After this commit, notifications support a lazy translated string as message props
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.
Previously, we removed the crash manager and moved its responsibilities
to the error service.
Because the crash manager was used in both the frontend and backend, and
because the infrastructure code required to use the error service in the
frontend hasn't been written yet, the crash manager has been moved to
the frontend assets where it is still needed in the interim. Most of the
logic of the crash manager has been moved to public_crash_manager (as it
is now the only crash manager and it doesn't make sense to keep the
inheritance hierarchy).
References to the crash manager in the backend were adapted where needed
or removed where they were no longer useful.
closesodoo-dev/odoo#943
Related: odoo-dev/enterprise#174
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit improves the popover service in two ways:
- it moves the popover state and handling into the service itself
- it removes the use of private functions such as __destroy
closesodoo-dev/odoo#961
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, if the loading of a js or a css asset would fail
(via useAssets), a traceback with an incorrect message would appear.
This was due to the fact that a promise was rejected with an event as
parameter. We correct this by rejecting the promise with a custom error.
closesodoo-dev/odoo#960
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
* iap, web_tour
This commit changes the API of the dialog service.
Before, the API gave 2 functions: "open" and "close".
Now, there is only one function "add" which is the same as "open"
but returning a callback that does the close.
closesodoo-dev/odoo#940
Related: odoo-dev/enterprise#171
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
This commit does some improvements on notification system:
- move notification handling logic in service
- remove use of __destroy
- simplify types
closesodoo-dev/odoo#955
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In this commit, we simplify the dialog template by removing the Portal.
The Portal is no longer used, as now we always use the dialog service to
open a new dialog.
also:
- remove the dialog container class from the webclient;
- add the dialog container class to the dialog container;
- move the management of the inactive modal class to the dialog container;
- remove the dialog manager class from the dialog container;
closesodoo-dev/odoo#947
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
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>
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).
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.
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.
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.
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
closesodoo-dev/odoo#945
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
The new py interpreter was missing the subtraction of a date with a
relativedelta
closesodoo-dev/odoo#944
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>
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.
closesodoo-dev/odoo#935
Related: odoo-dev/enterprise#169
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
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.
closesodoo-dev/odoo#936
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>