- Error handlers have been simplified, handlers don't returns functions
anymore and take 3 params: env, uncaughtError and originalError.
- Source maps have been reintroduced.
- The original error message and name are now concatenated to
the "wrapper" error ones.
closesodoo-dev/odoo#895
Related: odoo-dev/enterprise#154
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
After this commit, adaptations for the more menu behaviour are not
computed when there is no sections menu at all.
Also, before this commit, the more menu dropdown was always attached
in the dom, even if not visible. Now it is only attached when needed.
closesodoo-dev/odoo#814
Related: odoo-dev/enterprise#102
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit brings the x2ManyCommands from the legacy basic_model.js file
into the orm_service.js file in order to ease devs works as it has been done
in the Commands class in Python code.
closesodoo-dev/odoo#891
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
This commit improves the service API to allow the service creator
to mark some methods of the service as 'async'. This is a very
important feature when we consider the fact that a component calling
such a method may be destroyed before the asynchronous work is
complete. In that case, we do not want any code from the component
to be executed. Such async method, when called in a component (i.e.
when the service was obtained with the useService hook), will be
wrapped in such a way that the returned promises will not be resolved
if the component is destroyed.
Note that it only impact method calls for services obtained from the
useService hook, not calls for the actual service obtained from the env.
closesodoo-dev/odoo#886
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Writting tests in which input/select elements are involved can become quickly cumbersome
when some external libraries are used somewhere to interact with/manage them. Indeed, change some
input/select value normally triggers some event of a precise form and this has to be properly mocked
in the tests if one expect the libraries to react properly.
The present commit reintroduces the old helper "triggerEvent" (and its generalization "triggerEvents")
that should help in that kind of task.
closesodoo-dev/odoo#887
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
The present commit reintroduces several number parsers that were previously defined in web.field_utils:
parseFloatTime, parseInteger, parseMonetary, and parsePercentage. Some minor simplifications in their API
have been brought. Notably, the "field" parameter has been removed. Indeed, we expect those parsers
to be used in more specific contexts than before so that the advantage of having a common API (value, field, options)
has become less important.
This commit renames the DebugManager to "DebugMenu", changes the
structure of its registry and the signature of its hook (useDebugMenu).
In the previous DebugManager:
- the "debug" registry was flat;
- new items were declared and created with the "useDebugManager" hook;
- these items were arbitrary functions returning a set of items.
The problem with that system was its extensibility, meaning that no
external module could hook on these arbitrary functions passed to the
hook.
In the new DebugMenu:
- the "debug" registry has multiple levels:
> root: "global" items, found in most debug menus
> subcategories: each subcategory has a name corresponding to the
context it's instantiated in (e.g.: the "view" subcategory will only
contain views-related debug menu items)
- all items are pre-declared in their corresponding category, and either
return a debug menu item or null;
- the hook activates/deactivates categories, and passes a context which
will be used by the item factories (passed as argument).
This commit adds some error types to have more accurate errors.
These types can be more easily found as they have an other name
than Error.
closesodoo-dev/odoo#885
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Before this commit, error handlers checked the error name to know if
they should be executed.
Now, they check the instance type of the error to be more accurate on which
error an handler deals with.
This commit also changes `emptyRejectionErrorHandler` sequence number
because it had more priority than `rpcErrorHandler` and `lostConnectionHandler`.
This commit, refactor the dialog api (dialog.js), to easier the creation
of dialog subclasses; force the use of dialog subclass when calling the
dialog service; forbid the use of dialog itself and promotes the use of
dialog subclasses.
closesodoo-dev/odoo#871
Related: odoo-dev/enterprise#151
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit adds the useEffect hook, inspired by React. This hook
replaces the onMounted, onWillPatch, onPatched and onWillUnmount hook.
The idea behind useEffect is to unify the way we add side-effects to the
components lifecycle, while also making it easier to clean up those side
effects when needed. A lot of the time, when you want to do something
once the component is mounted, there is also a good chance you would
like to do it again when the component's state or props changes, in that
case you may also want to clean up things that you did on the previous
render. useEffect covers all these use cases and more.
The API is like that of React, with an important difference: the
dependencies of the effects is a function returning an array instead of
a plain array. This is because in React, hooks will run on every render
while in OWL, hooks are only run once during the component setup phase.
This means that in React, dependencies are computed on every render, and
doing that in owl requires having a callback to recompute them. Because
computing your dependencies can be expensive, the dependencies computed
by the callback will be passed to the effect function so that it doesn't
have to recompute them. (In React, since you're writing in the render
function, the dependencies are already in the effect's closure).
This commit adds jsdoc and typings to the dropdown components
and also rearranges a bit the code so it is cleaner and simpler.
Most part of the diff is about the keynav feature.
closesodoo-dev/odoo#802
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
- file is now ordered by clean sections
- `confirm()` helper has been renamed to something more appropriate
- `strftimeToLuxonFormat()` was manually cached. It now uses `memoize()` from `core/utils/functions`
- memoization of `stripAlphaDupes()` because it is prone to get called really often with same arguments.
- no more export `parseSmartDateInput()` as it is never imported elsewhere.
- remove unecessary `setLocale` call in `luxon.DateTime.prototype.toJSON` patch
closesodoo-dev/odoo#867
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Popover services:
- move bus from file scope into the service scope
- add "specializeForComponent" to add some logics when component is
unmounted
- parameters passed to the manager isn't stored in state anymore to
prevent props to be proxified.
Popover tests:
- remove a todo comment
- prettify template strings
- fix "Recompute position" test
Popover services tests:
- extract PseudoWebClient creation to lighten tests
- add test related to "specializeForComponent"
Doc updated
Before this commit, the router service used in tests was almost
entirely mocked and some of the mocked features didn't correspond to
their original counterparts.
Now, the actual router service is used in tests and the browser object
is mocked instead, allowing to correctly test the routing features.
Style using as much as possible predefined variables rather than
arbitrary values. Review status arrow buttons design and increase
overall text's contrast.
Style using as much as possible predefined variables rather than
arbitrary values. Adjust cards ':focus' state to match other
components and avoid misleading shadows.
Drop custom 'bg-X-full' classes since we can now achieve the same visual
result using default 'bg-X' classes (it was not the case with prev.
bootstrap versions).
Ensure text readability for both 'bg-X-light' and 'btn-link' classes.
Prior to this commit, Bootstrap dropdowns, jQueryUI dropdowns and Odoo
dropdowns where styled independently leading to visual inconsistencies
and code repetition.
This commit will customize and improve the Bootstrap design using as
much as possible predefined variables. Then it will simply '@extend'
owl/jQueryUI classes in order to visually match the bootstrap ones.
Since dropdown classes are used in the top-menu (and its design is
partially shared with frontend apps), this commit provides the necessary
adaptations for this component as well.
Mirror web_enterprise variables declaration to ease enterprise's
overrides. Reorganize variables in order to keep a consistent assignment
structure across versions.
This commit will also add '!default' flags in boostrap_overidden.scss,
allowing enterprise to reuse customization already defined in community.
This commit adapts the community codebase to the rewriting of the
/web application in owl.
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: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
In timesheets, which widget should be used to display durations depends
on the company's unit of measurements.
Previously, this was done by overriding the webclient's init method,
where we could check the company's UOM and insert the appropriate field
widget in the field widget registry.
In wowl, the extension mechanism that was used (include on webclient) no
longer exists, as such, this is now done in a service that is started by
the webclient during it's initialization, and as such, happens
essentially in the same part of the webclient lifecycle, but no longer
needs to patch the webclients internals.
When opening the dashboard in form view, some of the view options should
always have a certain value (in particular, the target should be inline,
and the form view should not have action menus or a control panel).
Previously, this was done through an override on the action manager when
executing a window action. In wowl, the action manager has been replaced
with an action service and its methods cannot be overriden.
This commit solves the same problem with a different approach, by
overwriting these options before trying to extract the view params from
the action.
This commit is the first phase of the conversion of the web/ JS
codebase to the owl framework. The impact of this commit is two-fold.
First, it rewrites the framework part of web with a new system of
services and registries. Services allow to execute code (e.g. do rpcs,
setup things) before launching the application. They can also expose
an API to be used by other parts of the application (e.g. a notification
service would expose a function to display notifications). Services are
often a good extension point for external modules that want to execute
code at webclient startup. Registries offer another way to extend the
application. They provide well designed extension points to add
elements/behaviors from the outside (for instance, to add a systray item,
an error handler...).
Second, this commit initiates the conversion of the webclient to owl
with a top-down approach, around those notions of services and registries.
The root of the web application is now an owl application. Among others,
the WebClient, ActionManager, Navbar, UserMenu, DebugManager, Dialogs,
services (e.g. notification, ajax...) have been converted to the new
framework/architecture.
Legacy views and client actions are still supported (and used). They
will be converted in the next months, and at some point, the support
will be dropped.
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: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Provide an opt in js tooling system by adding a node env with prettier and eslint configured.
3 bash scripts are provided: enable.sh, disable.sh and reload.sh.
Enable.sh: add to the community root (and optionaly to the enterprise root) the env.
Disable.sh: remove the env.
Reload.sh: disable then enable.
To prepare the rewriting of the webclient in owl, we move all
current js files of web in a legacy/ folder. This folder will
eventually be removed, as soon as each file it contains will be
converted to owl and moved to the proper place in the new file
structure.
Scenario:
- Go to Contacts
- Open a contact
- In "Contacts & Addresses" tab, add a child and configure its image
- Once child form is saved, image of the child is not displayed in the
kanban view used for children
It will only appear once the main contact form is saved.
The same issue occurs when editing a child image.
The new image will only be shown once the main contact form is saved.
The issue at the creation is due to the fact the function retrieving
the URL of the image tries to generate the URL from record id, which
is not set. It should use raw data of image in this case.
For the edition, it is due to the fact that the child form is changing
image_1920 field while the kanban view used for children is displaying
image_128 field. image_128 is a related field to image_1920, but it
does not appear in the child form. It is therefore not recomputed (by
onchange) when image_1920 is modified. Adding it in the child form view
solves the issue.
opw-2516188
closesodoo/odoo#72375
X-original-commit: 7eac23573c77415c84cb9c234c8063d4c68be425
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
The frontend enroll message was display as a `<small/>` tag, but it
seems that lxml HTMLParser parse it wrongly, for example:
html.tostring(html.fromstring('<small data-oe-model="test"><p></p></small>'))
returns:
'<div><small data-oe-model="test"></small><p></p></div>'
So branding attributes like data-oe-model that are on small tag are not
found on root node that has become a `div` tag after parsing => this causes
a traceback error when saving a change in this part.
Fix: use small as wrapper for `<div/>` tag that is treated correctly by
HTMLParser (span is also treated correctly but div makes more sense
here).
opw-2573955
closesodoo/odoo#72315
X-original-commit: 6334c7282c19362ca8bc79dbaefe3d38c055e746
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Before this commit, when editing a mass_mailing template, on save,
the editor would not tell the snippet menu to perform a cleanForSave
which it should normally do for the option to properly prepare to save.
Bug discovered while working on task-2327045
Ideally, would need to be backported but requires a different fix in the
old editor.
closesodoo/odoo#72346
X-original-commit: 639b6a55586107bd3d855d322c1102df101eb079
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>