Commit Graph
2854 Commits
Author SHA1 Message Date
FrancoisGe c2ae235ca5 [FIX] web: earlier record update for dirty fields
A field input always asks for a record update when it is the target of
a "change" event but such an event might occur after some keyboard
events (e.g. a "Enter"). In order to make keyboard navigation work, it
is necessary to make a dirty field communicate its new value before a
change event and make sure the record is correctly updated before being
saved.

Before this commit, this was done via a system based on a special event
triggered on the model each time a record is saved but that solution was
not appropriate:

- the updates done in that way were not correctly awaited.
- they would be asked for even if the save would not be the result of
  a keyboard event.

Here we replace the old system by a simpler one that works. When some
specific keyboard events occur, a dirty field ask for an update that is
correctly awaited.

closes odoo/odoo#96101

Related: odoo/enterprise#29873
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-28 01:29:59 +02:00
FrancoisGe efad2216b3 [IMP] web: focus of a X2many
When rewriting the Form view, we wanted the keyboard navigation using
"tab" and "shift+tab" to use the native browser behaviour. The purpose
of this commit is to remove the custom behaviour of X2many in a
form view when a "tab" or "shift-tab" make it be focused.

Before this commit, a new empty line would be created automatically.

After this commit, the button "Add a line" takes focus but no new line
is created.
If one wants to add one, that can be done by pressing "Enter".

Part-of: odoo/odoo#96101
2022-07-28 01:29:58 +02:00
FrancoisGe 05c66463bd [REF] web: use editInput in some tests
In this commit, we improve some tests by making them use the util
function "editInput". Indeed those tests were incorrectly reflecting
the edition of an input: normally, change the value of an input should
trigger an "input" event.

Part-of: odoo/odoo#96101
2022-07-28 01:29:58 +02:00
FrancoisGe 857cbba5a1 [FIX] web: X2many focus handle field
Before this commit, in an X2many in editable list mode with a handle
field, if you passed a record in edit mode, the handle field was focused.
The expected behaviour is to focus the first editable field.

Part-of: odoo/odoo#96101
2022-07-28 01:29:58 +02:00
FrancoisGe 87b8feee03 [FIX] web: X2many in list mode, press multi enter
Before this commit, in an X2many in editable list mode, creating two
valid records in succession by pressing Enter caused the first record
in the list to go into edit mode. The expected behavior is to add a new
empty line.

How to reproduce:
- Create a first valid record
- Press the enter key to validate it and a new line is created
- Complete this new line in a valid way
- Press the enter key to validate it

Result before the commit:
The first record switched to edit mode and there is no new empty line.

Result after this commit:
A new blank line is created in edit mode.
If you press enter again the empty line is validated and a new line is
created.

Part-of: odoo/odoo#96101
2022-07-28 01:29:58 +02:00
FrancoisGe afa12b9f04 [FIX] web: X2many in list mode with several records in edition
Before this commit, in an x2many in list mode, it was possible to switch
several records to edit mode.
Normally, it is not possible to have more than one record in edit mode
in a list mode X2many.

How to reproduce:
- Have an X2many with at least two record already.
- Modify a field of the first line and make it invalid
- Click on the second record

Result before the commit:
Both records will be in edit mode.

Result after the commit:
The invalid record stays in edit mode and the other record stays in
readonly mode.

Part-of: odoo/odoo#96101
2022-07-28 01:29:58 +02:00
Samuel Degueldre 1a77ace252 [FIX] web: fix buttonbox crash when it receives a class
Previously, attempting to add a class to a button box would crash
because the button box divs are compiled to ButtonBox component which
did not accept a class prop. This commit fixes that.

closes odoo/odoo#96726

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-27 19:20:11 +02:00
Samuel Degueldre c321f5a1e7 [FIX] web: correctly add o_xxl_formview class
With the conversion of views to the new webclient, the o_xxl_formview
class was no longer applied as expected, which broke the layout and the
width calculation in embedded list views (as the chatter would take up
more space than intended during the width computation). This commit
fixes that by adding the class when needed.

This commit also moves the css rules relative to that class which are
mainly used for the side-chatter, from enterprise to community, as the
side chatter has been made available in community as well.

closes odoo/odoo#96627

Enterprise: odoo/enterprise#29803
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-27 04:53:06 +02:00
Aaron Bohy a8d5787ce0 [FIX] web: record (quick-)created in grouped kanban are on top
Before this commit, the records created in grouped kanban view via
the quick create feature were displayed in the bottom of the column
where they had been created. They should be on top. This commit
fixes that issue. Note that this only concerns the state of the
kanban view before the next reload, as from that moment onwards,
the default order on the model is used.

Issue introduced by the conversion of the kanban view to owl.

closes odoo/odoo#96606

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-07-27 03:35:03 +02:00
luvi 0d8e4495c0 [FIX] web: upload files with Many2ManyBinaryField
This commit fixes the wrong implementation of the
field. It was not functional and is now using the
FileInput component.

Before the commit, it was not possible to upload or
delete files from the list. Test has been adapted to
those changes.

Toast notifications were also missing, and a new
test has been added to check that a notification is
correctly displayed when the server responds with a
error message for a given file.

Part-of: odoo/odoo#96357
2022-07-27 02:18:29 +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
Lucas Perais 03bd13e4c0 [FIX] web: legacy list switches view to form with the right resIds
Have a legacy list view, click on a record to open it in a new (WOWL) form view
Before this commit, the pager was wrong, as we never passed the list's current resIds
to the form.

After this commit, the pager of the wowl form view is correct.

closes odoo/odoo#96123

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-07-25 20:12:38 +02:00
FrancoisGe 263bef0737 [FIX] web: ListView use the correct label
This commit solves 2 problems in the list view:
- incorrect label for a column
- the label in the optional column dropdown can be different than
  the label of the displayed column

When converting the list view, we used the displayName of the widget
and not its label.

In order to improve the consistency between the labels in the optional
column dropdown and the associated columns, we decided to use the same
label.

closes odoo/odoo#96408

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-25 16:33:49 +02:00
Sébastien Theys 28200c5ad5 [IMP] mail, web: adapt chatter container in new form
task-2871070

Part-of: odoo/odoo#78221
2022-07-22 16:21:45 +02:00
+2 bc0a0cead6 [IMP] web,*: enable owl list & form views
The new list and form views were merged recently [1], but they
weren't activated because they weren't 100% ready yet. This is now
the case. This commit adds those views to the view registry. As a
consequence, a lot of qunit tests and tours needed to be adapted,
mostly for selector changes.

We also add legacy list and form views to the view registry, with
keys 'legacy_list' and 'legacy_form'. This allows to force those
legacy views when necessary. For instance, we did it in views
using complex custom legacy x2many field widgets that haven't been
converted yet (we have a compatibility layer but it isn't complete
and doesn't support every advanced usecases).

[1] odoo/odoo#92475

Part-of: odoo/odoo#78221
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-07-22 16:21:45 +02:00
Mathieu Duckerts-Antoine c5a8c4414c [FIX] web: load legacy x2many subviews
In a view form, legacy x2many fields with no view inline would not have
their subviews loaded. We fix that.

Part-of: odoo/odoo#78221
2022-07-22 16:21:44 +02:00
Mathieu Duckerts-Antoine 1d61d68207 [FIX] web: processing of field mode attribute
The view mode in which to display a legacy x2many field in a new form
view was badly processed. This lead those fields to be not renderered at
all (no list or kanban renderer displayed) or be renderered with the
wrong renderer in mobile mode. We fix that.

Part-of: odoo/odoo#78221
2022-07-22 16:21:44 +02:00
Mathieu Duckerts-Antoine 182b241e7d [IMP] web: support of fieldDependencies
Sometimes a field component might need to know some other fields values
to render itself or for other purposes. In legacy, a mechanism allowing
to load some field values not displayed was available: a field would
declare a fieldDependencies object specifying some field names and
their types and the related values would be loaded along the other data.

Here we introduce the same mechanism for the new views.

Note that in a new view list, the tag widget is not currently supported
so that we have remove some lines in the list arch parser that were
useless.

Part-of: odoo/odoo#78221
2022-07-22 16:21:44 +02:00
FrancoisGe ce61a35cf8 [FIX] web: crash when an arch as tree inside another tree
Before this commit, if an arch contained a tree which itself contained
a tree, the parser would crash.

The reason for this crash is that the parser was trying to parse the
second tree with the model of the first. So it didn't know the fields.

The solution is to stop the exploration of children when it is not
necessary. For example, for fields, it is not necessary to explore
the children, it is parseFieldNode that takes care of it.

Part-of: odoo/odoo#78221
2022-07-22 16:21:44 +02:00
Lucas Perais e3a54289ac [FIX] web: useViewButtons: add beforeExecute param
This rev allows the function built by the useViewButtons hook to take
a beforeExecute callback at call time, in addition to the existing
beforeExecuteAction callback that we can pass to the hook, at the
function's build time.

The rationale for this is to allow any caller to prevent the execution
of the action represented by the clickParams at the call level. It is
useful to check if a user is allowed business-wise to execute an action.

Part-of: odoo/odoo#78221
2022-07-22 16:21:43 +02:00
Samuel Degueldre 6ebf19b189 [FIX] web: fix statusbar field not displaying correct value in mobile
Previously, the statusbar field didn't display the currently selected
value for selection field in mobile, as the getter to compute the name
of the currently selected item only accounted for the many2one case but
not for the selection field case.

This commit adds handling for the selection field case and a test for
it.

Part-of: odoo/odoo#78221
2022-07-22 16:21:43 +02:00
FrancoisGe 91c32bb980 [FIX] web: X2m with custom controller
The goal of this commit is to allow an X2m in list mode with a custom
controller to use the controller context when creating a new line with
a 'tab' keydown.

Part-of: odoo/odoo#78221
2022-07-22 16:21:43 +02:00
FrancoisGe 415746602f [FIX] web: ListView with a class
This commit adds the ability to set a class on a list view.
This class will be added at the same level as "o_list_renderer".

For example:
    <tree class="myClass">
        ...
    </tree>

Part-of: odoo/odoo#78221
2022-07-22 16:21:42 +02:00
Jorge Pinna PuissantandSamuel Degueldre 2c9db825c1 [REF] base,web,*: convert settings form view to owl
*hr_timesheet,point_of_sale,website

This commit moves the settings form view implementation from base
to web, and converts it to owl.

The setting's search has been improved to take into account more
elements. Before, it was possible to only search on the field's
labels. Now, we can also search on the field's description, and
the titles of setting's group.

Part-of: odoo/odoo#78221
Co-authored-by: Samuel Degueldre <sad@odoo.com>
2022-07-22 16:21:42 +02:00
Samuel Degueldre 7b9b04f0a9 [FIX] web: fix form labels showing even when they should be invisible
Previously, if a label for a field had an invisible attr which should
cause it to be invisible, and it was not at the top-level of a group, it
would be rendered even when it shouldn't. This was caused by the fact
that when we compile the form arch, we don't copy the t-if attribute
from the original label when generating the FormLabel component.

This happens to work when the label is at the top level of a group,
because when compiling a group, if anything at the top-level of a group
has a t-if, we move it from the node itself to the t-set-slot that gets
generated for the FormGroup component before we would generate the
FormLabel.

Part-of: odoo/odoo#78221
2022-07-22 16:21:41 +02:00
Lucas Perais 6a73b3e7ff [FIX] web: form: fix ButttonBox More dropdown style
Before this commit, the More dropdown button of the ButtonBox
(which displays stat buttons) was broken i.e. the more button
was on another line because its size was wrongly set.

After this commit, the style is corrected, every button of the Box
is on the same line.

Part-of: odoo/odoo#78221
2022-07-22 16:21:40 +02:00
Lucas Perais 8ca03fb6e3 [FIX] web: form: the status bar must be present if in arch
Before this commit, when the status bar did not have buttons to display
it was not displayed at all.

After this commit, we display it even if there are not any button inside.

Part-of: odoo/odoo#78221
2022-07-22 16:21:40 +02:00
Lucas Perais 042e1a5c30 [FIX] web: form: form header should end up in sheet_bg
Before this commit, the header declared in a form's arch was not injected
at the right place.

After this commit, the header's elements are put as children of the sheet_bg element
if present.

Part-of: odoo/odoo#78221
2022-07-22 16:21:40 +02:00
Lucas Perais (lpe) d3f26c4aab [FIX] web: MainComponentContainer updates when registry changes
Before this commit, adding a component in the main component registry
after the initial mount did not work that is, the MainComponentContainer
never rendered the new component.

After this commit, adding a component to the registry works as expected.

Part-of: odoo/odoo#78221
2022-07-22 16:21:39 +02:00
Lucas Perais 3c7ace02df [FIX] web: layout: banner should not be in o_content
Part-of: odoo/odoo#78221
2022-07-22 16:21:39 +02:00
Mathieu Duckerts-Antoine 1c344b8955 [FIX] web: MonetaryField: can take 0 value
Before that commit a zero value for a monetary field would be wrongly
considered invalid. This would block many flows (e.g. a save).

Part-of: odoo/odoo#78221
2022-07-22 16:21:39 +02:00
Lucas Perais c0a67682cb [FIX] web: AceField: reset ace lib only if editor's element has changed
Before this commit, the ace editor crashed when switching to edit mode or
when clicking in it.

After this commit, it works as expected.

Part-of: odoo/odoo#78221
2022-07-22 16:21:38 +02:00
Géry Debongnie b4063a1e73 [IMP] web: update owl from 2.0.0-beta-14 to 2.0.0-beta-16
Release notes:

https://github.com/odoo/owl/releases/tag/v2.0.0-beta-15
https://github.com/odoo/owl/releases/tag/v2.0.0-beta-16

Details:

- fix: lifecyle_hooks: correctly wrap errors in async code
- imp: use a custom error class for all errors thrown by owl
- fix: package.json: remove browser value
- ref: component_node: slightly simplify code
- fix: components: fix cause left unset when thrown object is not Error

Part-of: odoo/odoo#78221
2022-07-22 16:21:38 +02:00
FrancoisGe 8746ffdc13 [FIX] web: use OnboardingBanner as default banner
Before this commit, the List and Kanban views did not allow the use of
a Banner without adding it in the View definition.

Like this:
```
export const listView = {
    ...
    Banner: OnboardingBanner,
    ...
}
```

Now, we use by default OnboardingBanner as Banner if no other has been
defined in the View definition.

closes odoo/odoo#95945

Related: odoo/enterprise#29452
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-21 00:50:05 +02:00
FrancoisGe 5ee62cc927 [FIX] web: rename pluck to pick
Name error, the implementation of pluck is the pick function. So we will
rename the pluck function to pick.

Part-of: odoo/odoo#95945
2022-07-21 00:50:05 +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
Bruno Boi 6f6fb914b0 [FIX] web: ignore allowed company from session storage
When switching the company, if the displayed action hasn't any
identifier, the RPC will be based on the previous company.

To reproduce the issue:
(Need stock. Use demo data)
1. Inventory > Operations > Inventory Adjustments
2. Enable the column 'Company'
3. Switch the company to "My Company (Chicago)"

Error: The quants of "My Company (San Fransisco)" are listed -> this
does not respect the selected company

On step 1, when clicking on Inventory Adjustment, it loads a Server
Action that returns another action:
https://github.com/odoo/odoo/blob/68657a85eb09dd306feab91d805b8c21eb75010f/addons/stock/views/stock_quant_views.xml#L356-L364
The returned action is a Window Action built on PY-side:
https://github.com/odoo/odoo/blob/b5d16141dc48d4379452ea40e167f3b00f956c20/addons/stock/models/stock_quant.py#L283-L300
So this Window Action hasn't any identifier (there isn't any
`action=...` in the URL)

Later on, when reloading the page (because of the company switch), we
try to load the action. To do so, we first call `_getActionParams`. In
this method, we take the current state and try to extract some
information. Because there isn't any action defined on the state (as
explained in the previous paragraph), we use the `current_action` stored
in the session storage (i.e., the window action returned by the server):
https://github.com/odoo/odoo/blob/590fa18cafe2c7bbd109692f564c2175ca6d820c/addons/web/static/src/webclient/actions/action_service.js#L294-L302
And here is the issue: the stored action contains its context and this
context contains the `allowed_company_ids` key (-> with the previous
company)

As a result, when performing the search_read to get all the quants of
the view:
https://github.com/odoo/odoo/blob/f5ba34e45b66e0fccc2559bf434e255d38a0faa0/addons/web/static/src/legacy/js/views/basic/basic_model.js#L5016-L5025
And when getting the context, it leads to `_getEvalContext`
https://github.com/odoo/odoo/blob/f5ba34e45b66e0fccc2559bf434e255d38a0faa0/addons/web/static/src/legacy/js/views/basic/basic_model.js#L3716-L3728
We apply the user context (which contains the correct value for the
company) and then apply the element context (which contains the
incorrect one, as explained above)
This explains why it will display the quants of the previously-selected
company.

OPW-2871086

closes odoo/odoo#94039

closes odoo/odoo#96161

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-07-19 21:21:55 +02:00
Lucas Perais cdda5f50bf [FIX] web: relational model exports its offset
closes odoo/odoo#96079

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-07-19 20:13:18 +02:00
Lucas Perais 28c9a752f2 [FIX] web: list renderer: better handle unselect when clicking
Have an editable list, select a record, click either on a group header or on the list header
press the arrow down key.

Before this commit, there was a crash because we attempted at navigating with the keyboard inside the list from
a wrong entry point. The crash occured because no record was selected.

After this commit, when clicking on something else than a data row or a column that is sortable
we unselect the record. Hence there is no crash when navigating with the keyboard

closes odoo/odoo#96233

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-07-19 14:00:01 +02:00
Samuel Degueldre 106193e359 [FIX] web: fix useService binding service methods when it should not
Previously, the useService hook would call _protectMethod, which wraps
async methods so that any call to them after the component has been
destroyed throws an error, and any call that was started while the
component was alive but returned after the component was destroyed would
return a pending promise such that no more component code is executed.

In doing so, it would for some reason bind all the methods to the
service, this prevents some functionalities where a method would return
a differently configured version of that same service, on which you can
call the methods again (eg: orm.silent), as the modified service's
methods would not be bound to that modified service.

This commit fixes this issue by not binding the methods eagerly, and
introduces a test for all these behaviours.

closes odoo/odoo#96121

X-original-commit: 518a93a5487f62bd9b460412d4775cd0ac80a262
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-07-19 11:51:03 +02:00
Pierre Paridans f5ef77839f [IMP] web: Tooltip UX on touch-enabled devices
Port of legacy's BasicRenderer for WOWL views.

In a nutshell: Tooltips are problematic in touch devices as they are
meant to appear on hover... which doesn't happen with touch events.

This commit implements a "tap-to-show" behavior which let the user see
the Tooltip by pressing the element, and letting it disappear when the
pressure ends.

Part-of: odoo/odoo#95924
2022-07-19 11:50:51 +02:00
FrancoisGe c971becaa8 [FIX] web: add title props in ProgressBar
The legacy ProgressBar could receive a title in props that it had to
display.
In this commit, we add support for the title props in the new
ProgressBard field.

closes odoo/odoo#95922

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-19 11:50:45 +02:00
6acfad2651 [IMP] web: speed up pager total counter for large DB
Doing a `search_count` on millions of records could be very slow. On
large databases, the pager counter "1-80 / 8000000" could take several
seconds just to get the total number of records.

This commit limits the counter in list and kanban views to 10k records,
and shows "1-80 / 10000+" if the limit is reached. If you click on
10000+, it updates with the real count (or if you go up to 10000 with
pager or input value).

The search_count on res.partner of odoo.com takes 4s. With this patch,
it will take ~20ms.

Task 2761165

closes odoo/odoo#95642

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Damien Bouvy <dbo@odoo.com>
2022-07-19 11:50:24 +02:00
Simon Genin (ges) c5250fa65c [FIX] web: float field can be updated by another field/widget
The new implementation of float field has some problems dealing with
external changes that would impact it. The specs are changed to format
on blur. It was overly complicated not to as the behavior of all input
fields are controlled through the input field hook.
Note: in the past, formatting would only occur after a save action, now
the formatting is on blur.

The input field hook had some issues dealing with invalid and dirty data
so this has been fixed as well.

closes odoo/odoo#95364

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-19 11:50:21 +02:00
luvi 9e35122520 [FIX] web: ExportDataDialog behavior and style
When unselecting an export template, the list was empty
instead of just keeping the current list. I also added
some tests for this component introduced in Owl recently.
Some scss changes have been done to remove unnecessary
lines from the file and fix the style in a small window.

With a small window, items from the export list are not
draggable and the list must be placed at the bottom
part of the dialog

closes odoo/odoo#95226

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-19 11:50:12 +02:00
Lucas Perais 2deb6aa1eb [FIX] web: tests: fields: color picker improve stop click test
Before this commit, we asserted that the view did not switch to form when clicking
on the the color picker. It was wrong because there is no action manager, hence no possibility
to effectively switch view.

After this commit, we assert that the list view's callback selectRecord is not called, which
is equivalent.

closes odoo/odoo#96159

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-18 18:42:17 +02:00
abd-msyukyu-odoo 40dda26350 [FIX] core, web: handle read_group ranges for multiple granularities
There was an issue with the computed `read_group` `__range` when grouping on
the same date/datetime field on multiple granularities (i.e. month, week).
Since the range was stored with the field_name as a key, the last evaluated
range would override the previous ones.

Impacted Versions:

  - master
  (- exists since 15.0 but it does not impact the user directly so it has been
  decided to fix this only in master, since the API is modified)

Steps to reproduce:

  1. Open a list view and group by a date field with at least 2 granularities
  2. Open the chrome debugger (network) and check a web_read_group rpc preview
  3. Find the web_read_group for groups related to one of the largest
     granularities and check the `__range`

Current behavior:

  - `__range = {field_name: false}`

Expected behavior:

  - `__range = {field_name: {from: range_start, to: range_end}`

Explanation

Since the smaller granularities are evaluated last, and the condition to update
`__range` is related to the field_name and not the granularity, the range is
always overriden by the smaller granularities (even if their value is False)
when grouping on the same field with multiple granularities.

Furthermore, there is a conceptual problem with the current solution: it does
not allow to store multiple ranges when the read_group is not lazy and when
grouping on the same field with multiple granularities.

Therefore, the proposed solution is to use the full groupby keys in the
`__range` to allow storing multiple ranges depending on granularity. The keys
in `__range` would thus match the group value keys and allow more flexibility
if a domain must be forged from the group(s) range(s).

Task-2894519

closes odoo/odoo#95193

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-07-14 18:03:50 +02:00
Matthieu Stockbauer 3ae11c87e8 [IMP] mail, *: adapt bus service to wowl env.
*: bus, calendar, iap_mail, im_livechat, project, web.

In order to ease the PR introducing the websockets in Odoo, the bus service
has to be updated to be a wowl service. This PR takes care of it.

task-2053917

closes odoo/odoo#95824

Related: odoo/enterprise#29361
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-07-14 11:42:42 +02:00
Michael (mcm) 2faf0ac64d [FIX] web: fallback for domain selector operator
Before this commit, it happened that the domain selector
couldn't find the operator linked to the field.
This commit adds a fallback on the existing operators
to find an operator that matches.

for example the domain `[["name", "like", "M"]]` gave
`Name ? "M"`, now it correctly gives `Name like "M"`.

closes odoo/odoo#95891

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-13 18:49:50 +02:00
Michael (mcm) da8f1d44c9 [IMP] web: add in_dialog option to domain field
In legacy, the domain field had an `in_dialog` option that was
used to display a button that opens a dialog to edit the value.
This commit reimplements the `DomainSelectorDialog` in owl
and adds the option the new domain field.

closes odoo/odoo#95768

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-13 17:40:57 +02:00