[FIX] *: selectors in tours
[FIX][TMP] account: CogMenu selector in tours
[FIX][TMP] web*: Breadcrumb targetting in tours
Adds a `o_breadcrumb` class to target the whole breadcrumb, no matter
how much elements it contains (collapsed parts, visible path, single
name...).
add classname on last breadcrumb item
[FIX][TMP] project: View buttons selector in tours (moved away from CP)
[FIX][TMP] project: Kanban selectors in tours (quick create)
[FIX][TMP] *: SearchBar selectors in tours (toggle menu)
[FIX][TMP] *: ButtonBox selector in tours
[WIP][IMP] web: add toggleSearchBarMenu in search helpers
adapt and unskip 3 list tests
adapt and unskip calendar tests
unskip web_tour test that actually pass
post rebase fix
allow to lose cell focus after multi edition (given to searchbar) - bug reported, to check later
post rebase fixes
fix
Part-of: odoo/odoo#116641
This commit introduces various improvements to simplify, speed-up and/or
strengthen consistency in the date utility functions and localization
service.
It also takes care of removing luxon<->moment conversion helpers since
they are only used in the date picker, which has been rewritten.
Part of task 3121497
Part-of: odoo/odoo#112171
This commit does the following in the Web module utilities:
- makes the `fieldDependencies` property of the field objects
definitions a function instead of a list of strings: this makes it
possible for fields to extract their dependencies based on the fields
info from the arch;
- adds/improves types and documentation for some utility functions.
Part of task 3121497
Part-of: odoo/odoo#112171
**Before this commit**
The popovers will close on click away.
This makes impossible to start selecting text within a popover
using the mouse and finishing the move outside of the popover
(as it will get closed).
**After this commit**
Popovers will close on mousedown away instead, which is a general
standard for user interfaces anyway.
Part-of: odoo/odoo#118066
This commit adds several improvements and overall changes the way
draggable builders can be built, adding some helpers to temporary
manipulate DOM elements during drag sequences and making some changes
on the way drag callbacks are handled.
The current implementations of draggable hooks built with this feature
have been adapted.
The drag test helpers have also been reviewed to more accurately
mimick real-life scenarios and allow for more flexiblity (i.e. moving an
element to a certain point during the drag sequence before being
dropped).
Part-of: odoo/odoo#110819
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Before this commit, some QUnit asserts and test helpers taking a
"target" param (or equivalent) would try to evaluate it, among other
possibilites, as an HTMLElement.
This is too restrictive however, as all these helpers can also be
performed on 'Element' instances (querySelector, classList, etc.), which
covers other sub-classes than HTMLElement, such as the whole range of
SVG Elements.
This commit changes the checks for `instanceof HTMLElement` to
`instanceof Element` instead to allow the helpers to be used on the
whole range of native Elements.
Part-of: odoo/odoo#110819
Co-authored-by: Julien Mougenot <jum@odoo.com>
This commit adds a new SelectMenu component. This component makes it
possible to search for options for a select element. It can be used to
replace the jquery select2 element for most cases.
Changes have been made to the Dropdown component as well as the position
hook, to allow the menu to be placed with the same width than the toggler,
using the 'fit' variant. Tests have been added to assert this position
feature.
Tests have been added to make sure the behavior of this component is
working as expected, and let the core element's usage being asserted.
Part-of: odoo/odoo#106265
Co-authored-by: luvi <luvi@odoo.com>
**Before**
A traceback is raised when pressing shift-tab on the first column of
the first row in a focused list field as shown in the vid:
https://youtu.be/g97ZTp1QdBE
**After**
shift-tab on the first column of first row will now unselect the list field
and immediately focuses on the previous field.
**Additional change**
We now allow skipping focus on the dropdown toggler by introducing new
props.
closesodoo/odoo#103485
X-original-commit: 9ba9977e42d201035b5299bc13ba03211cddbc1f
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
This commit does multiple things:
- The readonly mode of form view is removed but not for the fields.
it means that the fields in the view are always in edit mode except
if we force them to be readonly.
- The control panel is revamped to take less vertical space and shows now
the record editing (dirtiness)/validity status after editing the record.
- The record is saved only when leaving the view or by clicking the save
button when hovering the record status in the control panel.
- The record can still be discarded by clicking the discard button when
hovering the status text in control panel.
task id: 2822553
X-original-commit: 77824ad44b6945a9811120380747f87ef6362ae2
Part-of: odoo/odoo#101118
Co-authored-by: luvi <luvi@odoo.com>
This commit introduces the new calendar view written in owl.
closesodoo/odoo#101185
X-original-commit: e88988f58582d5b49a32d7102a74a176f40c4c69
Related: odoo/enterprise#31808
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
"phone" isn't a valid input type, so it had no effect, except
breaking the tour system when a PhoneField input was the target
of a step, since the "consume event" was then "click" instead of
"input"..
closesodoo/odoo#100388
Related: odoo/enterprise#31437
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
XML files are now declared in python module manifests. During the qweb
't-call-asset' directive, assetbundle will fetch the declared xml files,
apply the inheritance (t-inherit) and create a javascript service (for
eg: 'web.assets_backend.bundle.xml') which is added at the end of the
*.js mimifier file.
When the debug mode is activated, comments are added in the template
indicating which file the template comes from as well as the
inheritances applied to it.
****
JavaScript:
assets.js (module @web/core/assets) takes care of loading libraries,
javascripts and styles.
`loadJS(url)` (loads the javascript and returns a resolved promise when
the templates are also loaded via the '*.bundle.xml' service)
`loadCSS(url)` (loads the style a resolved promise when the file is
loaded)
`loadXML(xml, app=assets.defaultApp)` (load template into
application/owl, used by the `*.bundle.xml` services)
`getBundle(bundleName)` (get the bundle descriptor)
`loadBundle(desc)` (load the files and bundle from a descriptor)
templates (XML element content all owl templates)
A new `ready(serviceName)` method on boot.js lets you know when a
service is loaded are the require.
The xmlDependencies attribute no longer exists.
Python:
The xmls taken into account by assetbundle.py, applying `t-inherit`
inheritances and adding an `name_of_the_bundle.bundle.xml` service in
the generated JavaScript file.
****
Every manifest changes is into the next commit, except 'web_tour' in
this current commit as example.
Part-of: odoo/odoo#95500
This commit allows the 'editInput' test handler to also handle inputs of
type "file". To do so, the value must be a file (or a list of files),
and the handler has been refactored to accept a certain given value only
if its type allows it.
Part-of: odoo/odoo#98251
Before, it was possible to drag&drop an element from a point to another.
However it can be useful for tests to drag, make actions/tests
and then drop.
Now, the user can use the `drag` function and drop after with the
returned function.
Part-of: odoo/odoo#98897
Before this commit, the isVisible helper would most of the time work as
expected, except if an element has display: contents. In that case, it
has no bounding box, but it may still be visible if one of its child
is visible.
This is particularly important since we want to set the display property
of all field components to "contents".
Part-of: odoo/odoo#96865
This commit will trap the focus on the dialog, this will avoid modifying
a background record when a dialog is open. Trapping the focus on the
dialog is a well-known technique for modals (dialog).
closesodoo/odoo#96361
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit introduces the new kanban, list and form views written
in owl. Even though it contains the implementation of those 3 views,
only the kanban view is activated for now (the list and form views
aren't 100% ready yet, so they aren't added to the view registry).
Alongside the views, the fields (<field name="..."/> in archs) and
widgets (<widget name="..." in archs) of web/ have been implemented
in owl as well. Legacy ones remaining in other addons are supported
in our new views, thanks to a compatibility layer. The goal is to convert
them asap though.
Legacy views, fields and widgets are kept for now, which explains the
number of added lines in this PR (around half of them concern tests).
They are still extended by custom code in other addons, that still need
to be converted (a lot of them are already on the way). Moreover,
they are still used in Studio as well. The plan is to lazy load them in
the Studio bundle when all custom code extending them will be
converted. Studio will be converted for v17.
Part-of: odoo/odoo#92475
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>
Co-authored-by: luvi <luvi@odoo.com>
Before this commit, the test utils that trigger an event (e.g.
click) didn't check whether the target of the event was visible.
As a consequence, when writing a test, one might trigger an event
on an invisible and undesirable target, and don't understand why
it doesn't work due to the absence of feedback. This commit
improves that situation by throwing an error in those sitations.
Obviously, some tests relying on the former behavior needed to
be slightly adapted.
closesodoo/odoo#93549
Related: odoo/enterprise#28360
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Before this commit, patchDate used the machine offset and not the offset
fixed in luxon.
For example:
Date to Patch = 01-01-2000 10:30:00
Machine offset = -120 (UTC-2)
Luxon offset = 360 (UTC+6)
Before:
Patched Date = 01-01-2000 10:30:00 UTC-2
After:
Patched Date = 01-01-2000 02:30:00 UTC-2
closesodoo/odoo#91591
Signed-off-by: Bruno Boi <boi@odoo.com>
Since 43463a1 it was not possible anymore to trigger hotkeys
from an editable element excepted through
the hotkey option "bypassEditableProtection".
But there are cases where the editable element may want to always
allow any hotkey: e.g. the command palette search input.
Before This Commit
Impossible to trigger hotkeys from the command palette.
After This Commit
The command palette search input now allows any hotkeys.
closesodoo/odoo#90578
X-original-commit: 72dfe16ec8453ff299c2525431db619ccfdbfdec
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Bruno Boi <boi@odoo.com>
the patchDate function had these issues:
./addons/web/static/tests/helpers/utils.js
29:5 error Read-only global 'Date' should not be modified no-global-assign
58:21 error 'date' is already defined no-redeclare
Part-of: odoo/odoo#90578
Previously, the "debounce" util function was broken when passing
immediate=true, this was caused by the fact that the timeout was not set
to null after being executed, leading the function to always act as
though a call is already scheduled.
This commit basically rewrites the entire debounce function to fix this
problem, simplify the code, and make the API of debounce as close as
possible to underscorejs' debounce utility (with the exception that our
debounce function returns a Promise that gets resolved if and when the
call eventually goes through, and with the extra feature that the
debounced function has a cancel method to cancel the currently scheduled
call)
closesodoo/odoo#90297
X-original-commit: 24c39ba1744d83ef9712ef4d3df7db5baf35bc2e
Related: odoo/enterprise#26821
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Steps to reproduce:
- create a contact with a very long name
- create a quotation
- in customer, type the first letter of the very long customer's name
- try to use the horizontal scroll bar
Issue:
close window on horizontal scroll
Solution:
Discriminate an horizontal scroll from a vertical scroll
A test has been added as well as the triggerScroll utility function
to allow proper tests when scrolling on elements
opw-2777443
closesodoo/odoo#86744
X-original-commit: e0b26496196bd4ee39fa06e1a3274982d2c7fb12
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Iucapad <luvi@odoo.com>
This commit adds touch events helper for tests and new util used
to constrain a number between two values. The purpose of
the commit is to introduce the ActionSwiper component using those
functionnalities.
closesodoo/odoo#78426
Related: odoo/enterprise#21712
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Previously, when quickly mounting then unmounting a dropdown, a
traceback was shown. This is because the usePosition hook registered
listeners that were throttled/debounced, which would be called after the
component was already unmounted, causing the crash.
This commit fixes that by making cancelable the debounce timing util
and by introducing a new cancelable timing util: throttleForAnimation.
`debounce` and `throttleForAnimation` could be canceled i.e. when
a component is unmounted.
`throttleForAnimation` is used to replace throttle to avoid the popper's
scroll position not staying perfectly in sync with the page but instead
being slightly jittery, it effectively throttles a given function to the
display's refresh rate.
Also, the `throttle` util is kept unmodified but marked as deprecated.
Its implementation does not properly match its name, and we chose
to leave it as is because some code might already use it.
X-original-commit: a27bbda37f1ad444023cb1aae56675ac6c263cb2
Part-of: odoo/odoo#78261
Co-authored-by: Sam Degueldre <sad@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
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)
closesodoo/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>
In order to be able to easily patch Date in py_date_tests and elsewhere,
we refactor the code of the legacy and new patchDate functions.
X-original-commit: 0e697c82be80cae9cc993b4be179fec42b8dae83
Part-of: odoo/odoo#77035
This commit encapsulates the positioning logic of the Popover component
into a reusable hook. It also improves this logic by adding more
positioning directions and functionalities.
Before:
- only 4 directions (top, bottom, right, left : all middle aligned)
- the whole window viewport serves as a direction toggler
Now:
- 12 positions are available and are composed by 4 directions and 3
variants: {top,bottom,right,left}-{start,middle,end}
- the positioned element container is configurable. Default: window
Description:
When you use this hook, you make sure that your `popper` element (the
one you would like to position) is always placed at the given `position`
from the `reference` element. If positioning it so the `popper` element
is clipped off the `container` element, sensible fallback positions are
tried. If none is fully visible without being clipped off `container`,
the original position is used.
Usage:
usePosition(
reference, // [mandatory] HTMLElement or function giving HTMLElement
options // [optional] configure behaviour through options object
)
Options:
- popper (string): a t-ref reference. If none, component.el is used
- container (HTMLElement)
- margin (number)
- position (string): {top,bottom,right,left}-{start,middle,end}
Taskid-2578926
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.
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>
One of the qweb tests checks that in a t-set @t-value takes priority
over body contents. However this construct also triggers a warning
when invoked.
Mock out `window.console` during qweb tests, this suppresses that
warning.
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
closesodoo-dev/odoo#875
Related: odoo-dev/enterprise#148
Signed-off-by: Aaron Bohy (aab) <aab@odoo.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>
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>