Commit Graph
85 Commits
Author SHA1 Message Date
Pierre Paridans eef262abf4 [FIX] *: adapt QUnit tests and tours
[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
2023-05-12 22:59:22 +02:00
Mathieu Duckerts-AntoineandMichaël Mattiello c1436ba8ca [IMP] *: advanced search
We allow edition/creation of domains with a domain selector via the
search bar facets or the menu "Add Custom Filter".
The domain selector has also been improved and now support expressions
and a new operator "between" for some field types (those for which <=
and >= are valid operators). We also improve the support of the connector
not.

Task ID: 3063564

closes odoo/odoo#112326

Related: odoo/enterprise#37715
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
2023-05-08 15:18:03 +02:00
Julien Mougenot caf40dfe2d [IMP] web: Improve date utils & localization consistency
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
2023-05-05 13:52:21 +02:00
Julien Mougenot 6a6a1efbe2 [IMP] web: Popover closes on escape
This commit adds a global listener from the popover controller to close
itself when "Escape" is pressed.

Part of task 3121497

Part-of: odoo/odoo#112171
2023-05-05 13:52:21 +02:00
Michael (mcm) 6527b01199 [FIX] web: open mobile search view in a dialog
Before this commit, the mobile search view was sent to the end of the
dom (t-portal) and so was on top of everything even the dialog that
was opened after it. Now, the mobile search view is open in a dialog
and the depth level between it and other dialogs is fixed.

task id: 3273035

closes odoo/odoo#120432

X-original-commit: 726ee64fb8b76fa7ded38e1d7e51612546e748c3
Related: odoo/enterprise#40663
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-05-04 20:33:49 +02:00
FrancoisGe d0bb3554c1 [FIX] web: fix advanced search comparison test
This commit adds a patchDate to the "Several date filters and a comparison"
test. The patchDate will allow the date to be fixed and prevent the test
from being invalidated when the month changes in the real world.

closes odoo/odoo#120231

Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2023-05-02 11:22:17 +02:00
Mathieu Duckerts-AntoineandMichaël Mattiello ebf646b44f [IMP] *: ModelFieldSelector improvements
We refactor the ModelFieldSelector and ModelFieldSelectorPopover
components.

We also improve a bit ModelFieldSelectorPopover:
    - on first page, the button to go back is no longer available
      (so that it is now more difficult to produce an invalid path)
    - we always start with a page presenting the model where the last
      selected field name belongs to
    - the keyboard navigation is improved
    - click on model field selector opens the popover with the focus in
      the search input (if any)
    - for relational fields in popover: the user can either click on the
      relational field (and select it) or a special button that make him
      follow the relation to the field comodel

We also refactor the hook useDynamicPlaceholder to make it use a new
component DynamicPlaceholderPopover that uses ModelFieldSelectorPopover.

Task ID: 3272798

closes odoo/odoo#117951

Related: odoo/enterprise#39673
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
2023-04-19 21:58:34 +02:00
Mathieu Duckerts-Antoine 6e4862d2ba [IMP] web: filter menu closed on advanced search
We make the filter menu close itself when the user click on its item
"Advanced Search".

Part-of: odoo/odoo#117951
2023-04-19 21:58:34 +02:00
Mathieu Duckerts-AntoineandMichaël Mattiello 1c374b9b05 [IMP] web: Advanced Search
The old submenu "Add Custom Filter" of the menu "Filters" is now replaced
by a menu item "Advanced Search". Click on that item will open an
"Advanced Search" dialog in which the current search domain is displayed
in a domain selector. It is then possible to easily add/remove/edit some
parts of that domain before make a new search with the edited domain.

Task ID: 3269923

Part-of: odoo/odoo#118057
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
2023-04-13 17:57:13 +02:00
Bruno Boi 4e396aeeb3 [FIX] web: remove a window global assignation
Since 5da90dfc4 a test has been added in which
a global readonly variable from `window`
is reassigned.
Furthermore, it is the global "parent" which is
read-only and should nerver be modified.

closes odoo/odoo#117927

X-original-commit: 169a471c7d48891d3295e2b597300425fb145abc
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-04-06 16:12:26 +02:00
Maruan Aguerdouh (magm) cb345ea1e7 [FIX] web: traceback when trying to add favorite filters without name
Steps to reproduce:

- Install Sales, Subscriptions or similar app.
- Go to Sales, and try to save a favorite filter without name.
- It can also be done in the order lines of the Subscriptions, if
we try to add a product and select "search more", inside the new
window try to add a favorite filter without name.

Issue:

We got a traceback that's not user friendly instead of the proper
warning message, this is because inside the `saveFavorite` method we
check if the description is empty, but we can't use `.length` because
when we don't fill any name, the description is `undefined`.

Solution:

Removing the `.length` check, and just checking if the description is
undefined or not.

Forward bot up to master.

opw-3200499

closes odoo/odoo#115204

X-original-commit: c0fe1408da48e43b3e7e55de8e1c1edb09c982d2
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-03-21 09:36:07 +01:00
std-odooandPolymorphe57 defa390621 [IMP] web: allow to search properties fields using the top search bar
Purpose
=======
Add the properties fields in the search bar and allow to search
properties fields values.

Technical
=========
If the "active_id" is in the context, show only the properties
of the given definition record. Otherwise, show all properties
of all definition records.

Because fetching the properties definitions cost a SQL query and a RPC
call, the properties definition are fetched only if we unfold the
properties field (so it has no performance impact until we ask
explicitly to search a property).

Task-2980121

Part-of: odoo/odoo#101901
Co-authored-by: Polymorphe57 <dam@odoo.com>
2023-03-07 01:59:05 +01:00
FrancoisGe 225d9925dc [IMP] web: commands to navigate between views
This commit adds the possibility to navigate between the different views
of the view switcher from the palette command.

closes odoo/odoo#113658

Taskid: 3205658
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-02 19:25:19 +01:00
Mathieu Duckerts-Antoine 965fed0cd6 [REF] *: add dialogService in setupControlPanelServiceRegistry
From a practical point of view, it seems better to also add the
dialog service in the service registry when calling
setupControlPanelServiceRegistry.

closes odoo/odoo#113610

Related: odoo/enterprise#37510
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-24 14:20:30 +01:00
clesgow 5da90dfc4e [FIX] web,stock,mrp: check if viewSwitcherEntries exists
When using the ControlPanel's bottom-right slot in another component, if
`viewSwitcherEntries` wasn't defined in `env.config` it would raise a
traceback, as the template would try to check an `undefined`'s length.

Removed the workaround that added an empty `viewSwitcherEntries` in the
forecast report and the bom overview report since it's no longer
necessary.

closes odoo/odoo#112415

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-23 16:08:33 +01:00
Julien Banken 1d091b5f77 [FIX] web: fix inconsistencies in the standard view props definition
Currently, there are a few mistakes in the standard view props definition:
1. To check the type of each element in an array, the prop definition has
to include an "element" entry. In the standard view props definition, we
included an "elements" entry which will completely be ignored by the
schema validator of owl in debug mode.
2. The "element" entry is only used when the `type` entry of the prop
definition is `Array`. We will therefore simplify the property definition
and remove the "element" entry for the props that are not arrays.
3. The `orderBy` definition of the standard view props mismatch with the
`orderBy` definition of the `WithSearch` component and the search model.
This commit will fix that inconsistency for all those components and
update the tests and the JSDoc accordingly. It will then be possible to
set the `orderBy` value from the props of the `View` component without
getting an error in debug mode.

task-3056268

X-original-commit: 4911e6cd366eadc60923940364274b30372e1584
Part-of: odoo/odoo#112600
2023-02-20 11:37:22 +01:00
Nshimiyimana Sénaandhuvw 1309a8b86c [FIX] web: fix arabic date parsing
# Steps to reproduce
* Have Arabic language installed
* Create an invoice
* Register a partial payment (keep invoice open)
* Switch to Arabic language
* Click the register payment again

=> You should be met with a traceback

# Cause
Currently, the `parseDate` function relies on `parseDateTime`. If no
format is passed to `parseDateTime` (like in our case), the user's
`localization.dateTimeFormat` is used. `parseDateTime` implements
workarounds to allow parsing of dates (without a time).
However, those workarounds do not work with languages such as Arabic.

opw-3133992

closes odoo/odoo#112354

X-original-commit: 869b01da4948775d9a3009426a74cc9207e81374
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Co-authored-by: huvw <huvw@odoo.com>
2023-02-09 23:09:00 +01:00
Bruno BoiandKristjan Tehu 277ff4f469 [FIX] web: wrong UTC convert in constructDateRange
Before this commit:
- Let's say we are in January 2023
- User's TZ has an offset from UTC (say UTC+2)
- Purchase > Create an rfq
- Set order deadline to 1st of next month (February), at 0.05am
- Add some products
- Confirm order
- Go to Reporting > Purchase then pivot view
- Add a filter on Order Date for the current month (January)
- Collapse the row groupbys
- Group the rows by Order Data > Month
- You can see the record of February and it should not be seeable.

After this commit
- the date range is now properly computed

closes odoo/odoo#111847

X-original-commit: 20c9e473419b92bbed01617c494b75847c60eea9
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Co-authored-by: Kristjan Tehu <kristjan.tehu@estpos.ee>
2023-02-03 16:32:22 +01:00
Laurent Smet 19d999b7e6 [FIX] web: Allow select or not by default the dynamicFilters
On the bank reconciliation widget, we are using 2 dynamic filters "Receivable" and "Payable".
Otherwise, only one should be selected by default.

Enterprise PR: odoo/enterprise#35801

closes odoo/odoo#110831

X-original-commit: 2504a623f90022dfa1c64436b7bd6e113f82e82d
Related: odoo/enterprise#36207
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: John Laterre (jol) <jol@odoo.com>
2023-01-25 10:18:32 +01:00
Bastien Fafchamps (bafa) 357cd41085 [IMP] Web: SearchPanel, display an empty state when there is no record
Purpose:
When a list view with searchpanel is empty, the searchpanel is completely
empty and white, and it's unclear what it's for. Make it obvious by
displaying an empty state. This will typically happen in some views when
you have no data or don't have the groups needed to show filters.

Spec:
Display the following paragraphs with the bs classes "small" and "text-muted":
"No quick filter available."
"Update the filters in the search bar to display more records."
"Quick filters will become available if the records shown can be filtered."

closes odoo/odoo#107379

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-12-13 13:51:26 +01:00
Mathieu Duckerts-Antoine 050f258bca [IMP] web: search bar: name_search context
The keys from the action context were not available in the context of
a name_search done when a user expand a one2many field in the search
bar. We add them.

closes odoo/odoo#107660

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-12-12 13:19:10 +01:00
Mathieu Duckerts-Antoine 84a0d31ca7 [FIX] web: search model: one2many search default labels
When a one2many is used as a search default, its label has to be fetch
via a name_get in order to get a correct display of the facet
corresponding to that field in the search bar. It turns out that the
search model did not wait properly the return of the name_gets before to
start to compute the facets.

closes odoo/odoo#106624

X-original-commit: 50f58212410b321c1c4ad3d42a91cd1d23567308
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-11-28 13:20:44 +01:00
Bruno BoiandLuis González 29ca002ee5 [FIX] web: menus missing aria attributes
Some missing aria attributes from 14.0 are reintroduced.

They are required for screen reader users to be able to know if menus
are opened and if menuitems are checked (e.g. if a filter is applied).

closes odoo/odoo#106277

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Co-authored-by: Luis González <lgonzalez@vauxoo.com>
2022-11-23 13:24:51 +01:00
Thomas Lefebvre (thle) 37dfb6d12e [FIX] web: placing the domain in the kwargs of an rpc call
Steps to reproduce:
    - go to Contacts app;
    - add a reporting view (Graph, Pivot or Dashboard) (with studio for example)
    - tape any character in the search bar;
    - on "search related company for" field either use the arrow keys to go down to this and then click the right arrow key or click on the triangle to the left of this field.

Issue:
    An error occurs.

Cause:
    There is a mismatch between the parameters that are sent by the rpc call and those processed by the logic part.
    Specifically, the domain must be part of the kwargs and not the args of the params key in the rpc call.
    The problem occurs with a filter that looks like: `<field name="parent_id" domain="[('is_company', '=', True)]" operator="child_of"/>`

Solution:
    Move domain in kwargs under key named args in the params of the rpc call.

opw-3031096

closes odoo/odoo#106074

X-original-commit: 8a9b418b27dcc9b904413f14cd0443f9a5b10d17
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2022-11-21 08:25:20 +01:00
Jorge Pinna Puissant 4f24e34b39 [IMP] test_lint, *: eslint remove caughtErrorsIgnorePattern from no-unused-vars
Unused catch block arguments are now forbidden even when prefixed with an
underscore:  if the argument on the catch block is not needed, the use of the
optional catch binding is enforced.

Part-of: odoo/odoo#105433
2022-11-09 16:08:07 +01:00
Joseph Caburnay c22afcbe0d [FIX] web: custom filter display on selection field
**Issue:** When creating a custom filter for a selection field,
the selected value is not properly displayed. Note however that
applying the filter still works. The problem is only in the displayed
value.

This is caused by setting the "value" attribute of the selection
element which is always an empty string (because formatField doesn't
properly work for selection field). However, the empty string is not
the issue because it doesn't matter what "formatted value" is returned,
it is not needed. The selection field's value is based on the value
of the selected option.

**Solution:** To properly show the display text of the selection item,
we need to make sure that value of the selection field is not overridden
during its onChange event. As a result, the selected option will become
the value of the selection field, displaying the proper text.

Therefore, in the onValueChange event handler, if the field type is
selection, we don't reset the value of the the selection element.

closes odoo/odoo#105420

X-original-commit: afadac5e21e6af2111ef42852243e78bb085d7c3
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-11-09 12:37:10 +01:00
Joseph Caburnay 6785784702 [FIX] web: allow custom grouping with a stored m2m field
Custom grouping by m2m field is introduced here: https://github.com/odoo/odoo/pull/74985.
However, after refactoring in https://github.com/odoo/odoo/pull/73311,
users are unable to add custom groups based on stored m2m fields.
This is because the stored m2m fields are not included in the list of
"Add Custom Group" options.

In this commit, we are now again including the stored m2m in the options
for "Add Custom Group".

closes odoo/odoo#104873

Task-id: 3046183
X-original-commit: 5087d9011be7f46a4a3e05b1e951f2556f254b4c
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-11-03 16:43:42 +01:00
Joseph Caburnay c412f11c02 [REF] web,web_*: import owl features using "@odoo/owl" module
In @odoo-module files, we do the following conversion:

`const { ... } = owl;` -> `import { ... } from "@odoo/owl"`.

While in legacy odoo module (odoo.define):

`const { ... } = owl;` -> `const { ... } = require("@odoo/owl");`.

closes odoo/odoo#104260

Task-id: 3032274
Related: odoo/enterprise#33298
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-10-27 14:41:17 +02:00
Joseph Caburnay bcf2cf7d65 [FIX] web: introduce parser for many2one_reference field
ISSUE: When in debug mode, user have access to the "External
Identifiers" view. The search bar allows searching using "Record
ID" which is a `many2one_reference` field. When user inputs
a search query that can't be converted to number, "Record ID"
option is still available to the user. It results to traceback
when it's selected because the UI is creating an invalid "domain"
which makes the server search for a string on an integer
(many2one_reference) field.

Check the video for illustration: https://youtu.be/XEPUXHcjeRI

SOLUTION: We make sure that many2one_reference field is properly
converted when generating the domain from the search_bar by
using the integer parser. This basically excludes many2one_reference
field from the search options when the input query is not a valid
integer. See it in action: https://youtu.be/NQ-YrK6tDH0

closes odoo/odoo#104183

Task-id: 3005837
X-original-commit: bc9e8709309379bdd9191323cb015c89be7da1f9
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-10-27 11:38:47 +02:00
Jorge Pinna Puissant 886f3de768 [IMP] web,*: force props validation for components
*: base_automation, lunch, mail, mrp, project, web_editor, website

This commit adds a warning if the props validation is not set for a
component.

The props validation is important to tell how a component should be
used, by looking at its code, it's a good documentation of the component.
It's also critical, to test if the component is correctly used, if all
the obligatory props are passed and that there are of the correct type.

For more information, see: https://github.com/odoo/owl/blob/master/doc/reference/props.md#props-validation

closes odoo/odoo#103723

Related: odoo/enterprise#33044
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-10-26 16:07:18 +02:00
Simon Genin (ges) 66289abd5e [FIX] web: fix reactivity in custom filter menu
Before: On a map view, a bunch of points get loaded one by one. Each of
them triggering a new render of the controller. Currently, the useModel
hook does a deep render no matter what. If you are trying to set a
custom filter un the filter menu in the control panel, the content would
systematically diseapear (rerendered) when a new map point loaded.

After: To prevent this, setting the input node as t-model is a solution.
It allows owl to keep track of the value of the input and correctly
set it back when a render occurs.

closes odoo/odoo#100421

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-09-26 15:47:44 +02:00
Bruno BoiandLiu Jinjiu 49caf7c06b [FIX] web: disable timezone convert for Date field custom filters
Reproduction:
1. Install Timesheet, and load demo data
2. Mimic a timezone in browser (Chrome): Right click->Inspect->Sensors,
in the Location-> choose Other…, type “America/Puerto_Rico” in Timezone
ID, refresh the page
3. Go to Timesheets->Timesheets->All timesheets, choose pivot view
4. Add custom filter, Date is between 1st/Aug/2022 and 5th/Aug/2022,
apply
5. The filter result is correct but the tag in the search bar is “Date
is between 31/07/2022 and 04/08/2022”

This also happens to other fields with type Date, but not Datetime. For
example, in Accounting->Reporting->Invoices Analysis->Pivot view, the
same issue happens with Due Date filter. For Datetime field, it doesn’t
have the issue, for example in CRM->Sales->My pipeline, change to pivot
view, the custom filter for Assignment Date doesn’t have the time zone
issue.

Note: reproduction usually works during the daytime in Brussels.

Reason: miswriting when rewrote custom_filter_item from V14 to V15. The
value pushed to descriptionArray should not be changed on time zone.

Fix: in parseField and formatField, use default formatters/parsers options. Add test for the Date filters.

Related PR: odoo-dev@aeb8e49?diff=unified#diff-6d9230cfcd007b087b2851cbf0b4a33b26dc3c91087853da6fe7ce8c2b60e42f

Reference code in V14: https://github.com/odoo/odoo/blob/14.0/addons/web/static/src/js/control_panel/custom_filter_item.js#L170-L173

opw-2941231

Part-of: odoo/odoo#98980
Co-authored-by: Liu Jinjiu <jili@odoo.com>
2022-09-01 17:10:59 +02:00
Bruno Boi 0ae158bf43 [LINT] web
closes odoo/odoo#99295

Related: odoo/enterprise#30900
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-08-31 18:53:51 +02:00
Laurent Stukkens (LTU) 260def9c6f [IMP] web: support multiple default_period:
Prior to this commit, `default_period` attribute is taking a single value.
This commit adds the support for comma separated values.

task-2941625

Part-of: odoo/odoo#97321
2022-08-22 18:03:13 +02:00
Mathieu Duckerts-Antoine 719a53a424 [IMP] web: make names available in search model
The "name" attributes set on the filter nodes in a search arch are now
kept in the search items created from them. This will allow an easier
manipulation of search items (e.g. toggle a filter with a given name).

closes odoo/odoo#97913

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-08-11 09:35:51 +02:00
stefanorigano (SRI) b3990e7d13 [IMP] web: SearchPanel, revamp scss
This commit simplifies the component SCSS improving bootstrap
integration and allowing components other than 'SearchPanel' to use the
same tree-view design.

Part of the overall v16 SCSS optimization/restyle, task-2704984.

task-2795166

closes odoo/odoo#87687

Related: odoo/enterprise#25781
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-08-03 06:34:03 +02:00
Lucas Perais 6eb2238294 [FIX] tests: views: helpers: the view's env is not the global env
Before this commit in tests, when creating a view with makeView, the same env was shared for services, view and
main_components_container. This is rather wrong as bugs in prod could not be reproduced in tests.

For example: env.config was present in the env for every services and components, this is wrong as
only View must receive it in its env.

After this commit, makeView separates the env for services and top-level components from the one dedicated for View.

Part-of: odoo/odoo#96618
2022-07-28 09:14:43 +02:00
Aaron Bohy 5134eac428 [FIX] web: do not display control panel in form views in dialogs
Form views in dialogs should not display a control panel. Before
this commit, they did. To fix the issue, we reworked a bit how we
pass to the Layout component its "display" information (e.g.
whether it should display a control panel, and which parts of it).
Before this commit, it retrieved this info from the searchModel, in
the env. This doesn't allow a specific view to override it, for
instance the form view when it's in a dialog. To ease this, we
changed the Layout component s.t. it now takes a "display" props,
and no longer looks in the searchModel. Each view thus needs to
pass this as props.

closes odoo/odoo#96818

Related: odoo/enterprise#29857
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-28 03:51:11 +02:00
Mathieu Duckerts-Antoine 57be371457 [FIX] web: search panel: use action context when fetching data
In SearchModel, the calls to search_panel_select_range and
search_panel_select_multi_range were done without using the global
context (e.g. the action context), contrarily to what is done in the
legacy SearchPanelModelExtension. We fix that.

closes odoo/odoo#96458

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-07-26 20:46:47 +02:00
Laurent Stukkens (LTU) 86b683bb38 [FIX] web: add hideCustomGroupBy option
Prior to this commit, it was not possible to hide the 'Add Custom Group'.
This commit adds this feature and associated tests. Hiding this menu entry
 can now be performed by adding `hideCustomGroupBy: false` in the `View`.

This commit also uses `MAPPING`  values in the components assignment of
`ControlPanel` in order to improve code maintenance.

task-2845729
2022-07-20 15:23:54 +02:00
Romeo Fragomeli 1fcd098af5 [REF] *: BS5: migration
Automated change made by a lot of RegEx to change all think that is
possible to automate.

https://getbootstrap.com/docs/5.1/migration

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
Simon Genin (ges) 53595b9326 [IMP] web: number parsers: fallback on english localization
With this commit, if the user types something in a numeric field
input that doesn't match its localization, we try to parse it with
the english localization. If it works, we considerer that value.
Otherwise, we throw an error.

al request

Part-of: odoo/odoo#92475
2022-06-30 09:29:45 +02:00
+2 b0f20bcd09 [REF] web: adapt ControlPanel to support new owl views
This commit contains several adaptations of the Layout, WithSearch,
ControlPanel and its children components with respect to the
conversion of kanban, list and form views in owl.

In a nutshell:
 - ActionMenus: we didn't have an implementation yet, as already
   converted views do not need it.
 - ControlPanel: allow to move the focus from the search bar to
   the view and vice-versa + slight rework of the template to
   properly handle hidden areas.
 - CustomFilterItems: adapt to formatter/parser changes.
 - Layout: hide breadcrumbs in dialogs and allow to move control
   panel buttons in the footer (in dialogs as well)
 - WithSearch: only pass search props to the underlying view +
   take its content in a default slot

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>
2022-06-30 09:29:44 +02:00
+2 48ef812a63 [REF] web: kanban, list and form views in owl
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>
2022-06-30 09:29:44 +02:00
Aaron Bohy a715e63b88 [IMP] mail,web: tests: crash if triggerEvent called on invisible el
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.

closes odoo/odoo#93549

Related: odoo/enterprise#28360
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-06-14 22:07:08 +02:00
Mathieu Duckerts-Antoine a44b3f8fb3 [FIX] web: left/rigth navigation in search bar
Before this commit, if there were several facets in the search bar, it
was not possible to navigate correctly between them.

closes odoo/odoo#93547

X-original-commit: d2b6aab509717866ab42a9750adbb884ccec18a4
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-06-14 08:37:38 +02:00
FrancoisGe 646371b705 [IMP] web: tests: add patchTimeZone in test utils
This commit adds a testing utility function that applies a fixed time
zone to luxon based on an offset to the UTC time zone.

Part-of: odoo/odoo#91591
2022-05-24 17:08:53 +02:00
Mathieu Duckerts-Antoine 01d7f98e24 [IMP] web: search: domain evaluation uses action context
It is now possible to get access to the action context keys when the
search filters are evaluated. This means that a search arch filter like

    <filter name="my_filter" domain="[('my_field', '=', context.get("my_value))]"/>

can be safely evaluated if "my_value" is in the action context (or in
the user context or is builtin as before).

closes odoo/odoo#91959

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-05-20 21:09:00 +02:00
stefanorigano (SRI) 782047917f [FIX] web: cp's search menu-items, highlight design
As result of [1], control panel's search menu-items were highlighted
correctly on ':hover', but not using a keyboard.

This commit assigns the default <Dropdown> 'focus' class on both
circumstances.

[1] https://github.com/odoo/odoo/pull/87448

task#2852217

closes odoo/odoo#91206

Related: odoo/enterprise#27355
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-05-16 17:32:56 +02:00
Géry Debongnie b828cfc72c [REF] web, *: improve the way views are defined, reintroduce controllers
Earlier in Odoo, JS views were defined by defining 4 elements: View,
Controller, Model, Renderer.  This was complex in some way, because we
wanted to inherit behaviour as well, so it was necessary to think along
multiple dimensions to understand how the code was running.

Then, with Owl, we rewrote some views, and simplified them: views were
now just a Component. Most of the common behaviour now came from the
generic View component that instantiated the concrete view with the
proper informations.  In practice, views were still split in views
(which was the equivalent of the Controller of earlier views), Model and
Renderer

Now, this commit reintroduce the Controller, and change the way views
are defined: by an object with multiple metadata, and an (optional)
props function to compute the actual props used by the view.

As a result, views are now much easier to extend/modify.

closes odoo/odoo#89889

Related: odoo/enterprise#26728
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-05-02 22:38:02 +02:00