Commit Graph
4318 Commits
Author SHA1 Message Date
Mathieu Duckerts-Antoine 3abba287f7 [FIX] web: adapt editFavoriteName helper
With the last realease of owl, .trim now implies .lazy. This means that
if t-model.trim is used, the value will be updated in the state only when
the change event is triggered. Here we adapt the helper editFavoriteName
which was supposed to update the state value.

X-original-commit: 7a16b75a35a5bd60190ee5b437b925a2fa99fb70
Part-of: odoo/odoo#149507
2024-01-16 13:15:22 +00:00
Pierre Paridans 9d920ee859 [FIX] web: control panel create button shouldn't be shown in dialog
The kanban's create button ("New") is usually displayed in the
ControlPanel. But in the select/create dialog (like many2one dialog),
the create button is moved to the footer.

On small screen, the Many2X fields' selection view switches from a list
view to a kanban one but a different condition was used to display (or
not) the create button in the ControlPanel, which explains why the
ControlPanel's create button appears only on small screen (and not in
the same dialog open on desktop-like screen size).

This commit fixes it by reviewing the condition applied in both the list
and kanban views and normalizing them to be based on the (existing)
`showButtons` prop that controls the additional buttons added to the
ControlPanel.

Steps to reproduce (with a smartphone like screen size):
- open Contacts app
- open a contact
- open the company's selection
=> two "New" buttons are displayed (top and bottom)

opw-3431221

closes odoo/odoo#149329

X-original-commit: c21c600189b36b7b4b352f8017467c8ef7d07c87
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2024-01-14 18:05:05 +00:00
Hubert Van De Walle e660cd94a8 [FIX] web: no_quick_create option ignored
Steps to reproduce
==================

1. Install event
2. Go to Events
3. Configuration > Event Templates
4. Click on any event
5. Click on Communication
6. Add a line, change type to SMS
7. Type anything in Template
8. Click on Create "..."
9. The operation cannot be completed

Cause of the issue
==================

For many2one and many2many editable fields, the server sets the
can_create and can_write attributes on the field nodes. [1][2]

In some cases [3], those attributes are missing even though the fields
are actually editable. They are also absent for reference fields.

The `canQuickCreate` props was set to the following value:
`canCreate && !noQuickCreate`. When canCreate was absent, this was
evaluated to undefined, thus ignoring the noQuickCreate option.

Solution
========

When the permission attributes are missing, we have to assume that the
user has the appropriate permissions.

We also have to cast the extracted props to booleans as if you have an
props with a value of undefined, it will fall back to the default value.

In the test `no_quick_create option on a many2one when can_create is absent`,
we set the field as readonly and then cancel the readonly on the view.
This reproduces one of the bug of [3] which causes the permission
attributes to be missing.

-----

[1]: https://github.com/odoo/odoo/blob/fa6da3d63a3a4cce4e8ca788a49772925d318764/odoo/addons/base/models/ir_ui_view.py#L1296-L1297
[2]: https://github.com/odoo/odoo/blob/fa6da3d63a3a4cce4e8ca788a49772925d318764/odoo/addons/base/models/ir_ui_view.py#L1080-L1086
[3]: https://github.com/odoo/odoo/pull/138032

opw-3609799

closes odoo/odoo#148163

X-original-commit: efcb2a820bb57f1fae809725e799b3145fbbe599
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Antoine Demany (ande) <ande@odoo.com>
2024-01-11 15:16:22 +00:00
Lucas Perais a0db7871ab [FIX] web: useRecordObserver error bubbles
Have a fieldWidget using useRecordObserver. In its callback, have a line that will
throw an error.

Before this commit, the Promise created by the hook was not rejected, leaving the error untreated and
popping until the window's onunhandledrejection event handler.

After this commit, the error appears on the owl errors stack, catchable with the hook onError.

opw-3667395

closes odoo/odoo#148887

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2024-01-11 11:40:25 +00:00
luvi 6872f0a547 [FIX] web: prevent annoying focus on touch devices
This commit fixes an annoying issue when using Odoo on a tablet or a PC when using
the touch screen primarly. The virtual keyboard popped way too much when navigating
in between views and screens, since the focus is often set on inputs (mostly the
search bar with useAutofocus).

Steps to reproduce:
- on a Windows laptop or tablet with a touch screen, open any view
- the virtual keyboard appears
- you must touch out of the keyboard to use Odoo

To fix the useAutofocus hook, hasTouch is now being used instead of relying on the size
of the screen.

Autofocus test with isSmall has been adapted to specify that touch isn't modified, and
that the autofocus is still present. And another test has been added asserting the
behavior on a touch device.

In the form renderer, the autofocus set manually on the first element is now prevented as
well, reducing the popping effect of the keyboard when opening a view. A test has been
added as well.

task-3627697

closes odoo/odoo#148925

X-original-commit: 1f2ab6d5dda61a6aad6e0e9bd282195cdd990f15
Related: odoo/enterprise#54074
Signed-off-by: Romain Estievenart (res) <res@odoo.com>
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2024-01-11 10:06:41 +00:00
Simon Genin (ges) 2b9717400a [FIX] web: Kanban grouped on field with readonly expression
As a reminder, the readonly expression in grouped kanban can enable or
disable the drag and drop feature. If the view is not reaonly but the
field in the arch on which the view is grouped is readonly, the drag
would be disabled.

Before this commit, there was a regression introduced in commit
ba1a5509fa that made the kanban record not
able to evaluate the readonly expression in the fields.

This commit fixes the issue by making the kanban record evaluate the
provided expression. It does not however correctly evaluate the
expression if it contains another field as the drag and drop feature
can be enabled at a view level, not at a per record level. It would then
resolve to not readonly.

Task id 3611116

closes odoo/odoo#148533

Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2024-01-10 19:39:26 +00:00
Lucas Lefèvre (lul) 8a459f1859 [FIX] web: support False for selection in domain selector
The original issue (in saas-16.4) has been fixed in 17.0
by refactorings.

This commit only fw-ports the test

Steps to reproduce:
- Open the Subscription app
- click on the list cog wheel
- Spreadsheet > Insert list in spreadsheet
- Select the blank spreadsheet and insert the list
- right click any cell with a list function
- click on "See list properties"
=> boom `undefined is not iterable (cannot read property Symbol(Symbol.iterator))`

The list domain has the shape `["subscription_state", "not in", ["2_renewal", "5_renewed", false]]`
`false` makes the domain selector crash.

opw 3670344

closes odoo/odoo#148727

X-original-commit: cfdc9c6d62050e3aac4bf18f374e4772ce18a504
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2024-01-10 10:28:16 +00:00
FrancoisGe 9118bcb0c6 [FIX] web: Input Field always display the correct value
Before this commit, a Field using the useInputField hook can ignore values
from an onchange in some cases.

Problem:
=======
In order to know if it should apply the value of an onchange on the field's input,
the useInputField hook uses a useEffect which will check if the field is
not dirty (being edited) and if it is not invalid. If it true, it will apply
the value returned by getValue which often corresponds to record.data[fieldName].
By executing getValue, it will therefore start to observe changes in record.data[fieldName]
until the next render. If getValue is not executed then changes applied
by onchange on record.data[fieldName] are ignored because we don't observe record.data[fieldName].

Solution:
=======
Always execute getValue in the useEffect to always observe changes on
record.data[fieldName] and apply them correctly on the input if needed.
(It s a hack but we don't have a better solution for now)

How to reproduce:
================
- Go to a Form view with a field B with onchange and a field A (char field)
- Edit field B (an onchange is in progress)
- Insert a value in the input of field A
- The onchange is resolved with a value for field A
- The value in the input for field A does not change (because the field is in edition)
- Click outside the input for field A (trigger change event)
- Edit field B (an onchange is executed directly)

Before this commit:
    The value returned by the second onchange is not visually applied to
    field A. The old value is still present in the input.

After this commit:
    The value returned by the second onchange is correctly applied to field A.
    Its input contains the value of the onchange.

closes odoo/odoo#148711

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-10 10:28:13 +00:00
Leonardo Pavan Rocha c6f8b62196 [IMP] web: prevent action swiper from being triggered by fullcalendar
Currently in calendar views in mobile it is possible to create events selecting
the time of the event by dragging. However, in calendar we also have the action
swiper responsible for moving between weeks when swiping close to the borders.
The issue is that when trying to create events by dragging close to the border
will cause the action swiper to trigger a swipe, therefore switching to the
next week. This commit fixes this by adding a swipeInvalid prop to the action
swiper that will be checked during the touch move event handler. If the
swipeInvalid is executed at any move and returns true, the swipe is cancelled.

task-3635841

closes odoo/odoo#148541

X-original-commit: 7772b17f226ddb99060b51d6b337e5f5106b5c25
Signed-off-by: Arnaud Joset (arj) <arj@odoo.com>
Signed-off-by: Leonardo Pavan Rocha <lpr@odoo.com>
2024-01-10 06:12:28 +00:00
Hubert Van De Walle 796cb061d0 [FIX] web: enable zoom tooltip for ImageField in edit mode
Steps to reproduce
==================

- Set the zoom option on an image field (You can do it with studio
  starting from 16.3)
- Go to a record and hover over the image

=> Nothing happens

Cause of the issue
==================

The tooltip is only displayed in readonly,
but with https://github.com/odoo/odoo/pull/100570 ,
the readonly mode has been removed.
So it only applies for views with the readonly attribute.

Solution
========

Always display the tooltip

opw-3646005

closes odoo/odoo#148534

X-original-commit: e0f9a7eedfb91ea46969490cf261548835844907
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2024-01-10 06:12:27 +00:00
FrancoisGe 3e37dc21d5 [FIX] web: mockWebRead respect the spec of a many2one field
Before this commit, the mockServer didn't respect the unity specification
for many2one fields. When you do a mockWebRead and you want to read other fields
than "id" and "display_name" for a many2one field, the mockServeur ignores
this part of the specification.

The goal of this commit is to ensure that the mockWebRead respects
the full specification for many2one fields.

closes odoo/odoo#148483

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-10 06:12:20 +00:00
Julien Carion (juca) 640af08cad [FIX] web: invisible elements should not be considered tabable
This commit ensures that elements returned by the getTabableElements
method of the ui utils does not return invisibe elements. This fixes an
issue with the trapFocus method of the ui service which could set an
invisible element as lastTabableEl therefore making it impossible to
loop back to the firstTabableEl when the actual last tabable element is
focused and the client presses tab. Also fix a side effect of these changes
in list renderer where focusCell would be called before the cell width
computations which would work by chance before since getTabableElements
took into account elements with 0 width but is now no longer the case.
This is fixed by moving down the onPatched method which calls focusCell
underneath the useEffect method which performs column style computations.

Steps to reproduce:
- Go to any dialog with mail installed
- Press tab multiple times
- At some point, the address bar should be focused instead of the dialog
buttons

Explanation: the chatter is present in the DOM but not displayed so the
last tabable element that is detected by getTabableElements is a child
node of the chatter which cannot be reached.

OPW-3584847

closes odoo/odoo#148382

X-original-commit: c631bf09b927003edc4c2b85e8790e8e2e8c044a
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Carion (juca) <juca@odoo.com>
2024-01-10 05:04:33 +00:00
Aaron Bohy ac40c6eabb [FIX] web: x2many with non inline form: don't share active fields
Before this commit, the StaticList and its Records shared the same
reference to the activeFields. When an x2many record was opened in
form view (and that form view wasn't inline), we altered the active
fields to add the information coming from the form, and we loaded
the corresponding data for the record we open. However, by doing
so, we also altered the active fields of all the other records,
for which we didn't load the corresponding data. From that point,
a rendering of those kanban records could lead to a crash, because
we iterate over active fields and make the assumption that there's
an entry for each of them in data, which isn't the case.

For instance, this happened in a dev branch in project, in mobile:
after opening a sub task in form view, if we switched to another
notebook tab and then switched back, there was a crash.

This commit fixes the issue by creating a copy of activeFields for
each Record, s.t. when a record is opened in a dialog, only its
activeFields (and those of the StaticList) are altered.

Note that activeFields of the StaticList must be altered in this
case to ensure that the onchange spec is properly generated, with
the fields of the form view.

closes odoo/odoo#148351

Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2024-01-09 06:27:58 +00:00
Aaron Bohy 2005c38679 [FIX] web: view compilers: use compiler in cache key
Before this commit, the key for the cache of compiled templates
(in the useViewCompiler hook) only relied on the arch, i.e. we had
a cache hit if we had to compile an arch that had already been
compiled before.

However, the Compiler to use might change. When this happens, the
template must be re-compiled, obviously, as the ouput may differ.

For instance, have a kanban arch with a js_class (pointing to a
custom view with a custom compiler), and have that arch used in an
x2many (where js_class is ignored, i.e. where it is rendered with
the basic kanban renderer). This happens in project, with the task
kanban view, which is also used for the child_ids field, in the
task form view.

This could lead to traceback, as the compiled template might refer
to attributes of a the KanbanRecord that only exist on the custom
KanbanRecord, not on the basic one.

Part-of: odoo/odoo#148351
2024-01-09 06:27:58 +00:00
Chrysanthe (chgo) 40c183f6d9 [FIX] web: fix missing border-radius on arrow button
This commit fixes an issue about the last arrow button not taking the
`o_first` class  in some cases.

With Odoo 17, we introduced a new behavior for our arrow buttons.
This behavior includes an invisible element placed before and after the
first arrow button on the left and right side.

While this is working fine as long as you don't have any hidden item
insie a dropdown menu, once you trigger a stage that was folded into a
dropdown menu, this invisible element appears on the right side.

Since we use the `o_first` class that sets a `border-radius` on the first
element on the right side, this invisible element was taking that
`o_first` class.

To fix the issue, we search for the first element within the scope that
does not have a `d-none` class, and we then add the class to that specific
element.

task-3628288

closes odoo/odoo#145453

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-08 19:12:45 +00:00
luvi 507d420e9f [FIX] web: fix crash when adding more state selection options
Since the StateSelectionField component handles the hotkey registration,
it was necessary to verify that an hotkey can effectively be added, instead
of trying to register to alt+undefined.

This issue happens when having more options in the selection field. Since the
code is written in a way each listed option should have an hotkey associated,
which is not the case, because the list of supported hotkeys has a length of 3.
The command is then added, without an associated hotkey.

A simple test case has been added, using the hotkey to set a state, and asserting
the presence of more than 3 items in the dropdown.

opw-3620129

closes odoo/odoo#148343

X-original-commit: ab572de20367f67aab4092b9e600e5ebd4cce4a6
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2024-01-08 07:21:52 +00:00
FrancoisGe e0109a99f8 [FIX] web: header button with display="always" and invisible
Since the commit odoo/odoo@0d99f4b9d9, the header buttons with display="always"
can't be invisible. The invisible attribute is ignored for this type of
button in list view and kanban view.

This commit fixes this issue by adding t-if that will evaluate the invisible attribute.

closes odoo/odoo#148092

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-05 08:00:41 +00:00
FrancoisGe d61829f9a2 [FIX] web: close dialogs on navigation command
Before this PR:
Previously, when the command palette was opened and a navigation command
("/") was being executed with single or multiple dialog boxes behind it,
only the command palette would close. This left the dialog boxes open.

After this PR:
Now, when a navigation command ("/") is being executed from the command palette,
all the dialog boxes and the command palette close simultaneously.

Task-3441132

closes odoo/odoo#147956

X-original-commit: 7b32b235ec488d347285a9f47aa9d4b04b0b186c
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-04 12:02:02 +00:00
Hugo Carlier (Huca) bc98aad620 [IMP] web: add always_range option to daterange widget
always_range option on the daterange widget allows to always display this
widget as a range (two inputs separated by an arrow) even if both
start/end date are empty and not required.

task-3628069

Part-of: odoo/odoo#145167
2024-01-03 10:58:02 +00:00
Prakash Prajapati f1654683b6 [FIX] web: fix the test case related to the year
Before this commit, since we are no longer in 2023, the test failed
because there is no longer 2021 in the filters dynamically added in the
dropdown of the date filter. The reason is now we have the current year,
the previous one, and the one before, that is, 2024, 2023, 2022.

This commit adds a patchDate to be sure we will start the test in 2023,
to get the expected filters displayed (2023, 2022, 2021).

closes odoo/odoo#147809

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-01-02 16:09:51 +00:00
tsm-odoo 56a10b4536 [FIX] mail: fix non deterministic steps in qunit tests
Several tests are non deterministic because they are using
`assert.verifySteps` at the wrong moment. Helpers such as
`afterNextRender`, `nextTick`, `Deferred` are used but those are
either not reliable or cumbersome to setup.

This PR introduces an asynchronous API on top of
`assert.step`/`assert.verifyStep`. This will wait until steps are
executed or until the timeout is reached.

fixes runbot-52660,54471,52794

closes odoo/odoo#147455

Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2023-12-27 12:38:45 +00:00
FrancoisGe b467658170 [FIX] web: x2m in m2m_tags and x2m in list can be reordered
Before this commit, in a non-editable x2many in list mode, if there
is a field  "A" with many2many_tags which is displayed as an x2many
in list mode in the form dialog, it cannot be reordered with handle field.

Problem:
When we extend a record from an x2many to a form dialog, we use the
activeFields defined in the form view and patch them with those in the
list view. Currently, we always use the default order from the list view
even if it doesn't exist. So we always ignore the one defined in the form view.

Solution:
If there is no default order in the list view, we use the one in the form view.

How to reproduce:
- Go to a form view with an x2many field in list mode which contains
  an "A" field with the many2many_tags widget.
- Click on a record in the x2many
- A form dialog opens with field "A" in the form of an x2many in list mode,
  containing a handle field.
- drag and drop a line to reorder the records

Before this commit:
  It is not possible to reorder records

After this commit:
  It is possible to reorder records

Task ID: 3641933

closes odoo/odoo#147253

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-12-22 16:14:52 +00:00
stefanorigano (SRI) 473e629a09 [FIX] web: avoid rendering ButtonBox inside Dialog components
Prior to this commit, `ButtonBox` components were rendered inside
`Dialog` ones.

The approach created issues in the user flow, particularly in cases
involving intermediary records that were not yet saved yet.

task-3619180

closes odoo/odoo#146797

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-12-22 16:14:46 +00:00
Xavier Bol (xbo) 27ca5799d4 [MOV] web: move kanban helpers for tests in helpers file
Before this commit, the helpers for the kanban view are only used
in the kanban tests in web module and those helper functions are not
exported and so it is impossible to use it outside that file.

This commit moves the helper functions for the kanban view in a new file
called "helpers.js" in the same directory containing the tests for the
kanban views and export all the helper functions to be able to use it
anywhere we need to use those helpers in JS tests.

closes odoo/odoo#147279

Related: odoo/enterprise#53040
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-12-22 14:48:56 +00:00
Pierre Pulinckx (pipu) 95fcb25396 [FIX] web: calendar > filter panel > sort items ASC
Before this commit:
Filter items in the sidebar/panel are sorted DESC. Items without value
are put at the end of the sorted list (eg : Open Shifts)

After this commit:
Filter items are sorted ASC. Label that begins with numeric are also
sorted correctly. Items without value are stull put at the end of the
sorted list.

task~3524031

closes odoo/odoo#146127

Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2023-12-22 12:00:42 +00:00
Panagiotis Kyriakou c3e497f1d2 [FIX] web: augmented the context of many2many fields
Prior to this change, anything passed in the context of a m2m
avatar field would not be taken into account because the context
was not passed properly in the many2many_tags_avatar_field template.

This commit fixes that and also adds a test for future testing.

task-3599601

closes odoo/odoo#146562

X-original-commit: 03202b7c790be266674e12b96a0b99f44ac773ed
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2023-12-21 10:42:45 +00:00
Mahdi Cheikh Rouhou (macr) 13b338acd8 [FIX] web: solve datetime_picker with 12H format error
Isssue:
=======
When using a language with twelve-hour format (arabic) and open
datetime_picker it will raise an error.

Steps to reproduce the issue:
=============================
- Change lang to arabic
- Create a task in a project an try to modify the deadline

Origin of the issue:
====================
When we have `props.focusDateIndex != 0` and `props.range = False` we
will have only that index in the array `this.state.timeValues` ,
iterating over the array in `handle12HourSystem` function will result in
error because it starts iterating from index 0 which is undefined.

Solution:
========
Skip the undefined indexed;

opw-3629657

closes odoo/odoo#145424

Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2023-12-19 12:20:05 +00:00
Aaron Bohy 8f839e997c [FIX] web: allow to resize columns in grouped list views
Before this commit, columns in list views could be manually resized
only if there were records in the table. For the ungrouped case it
makes sense, as the table is empty anyway. However, for the grouped
case (either with empty groups, or with all groups being folded),
the list contains no records, but resizing could make sense as
there could be aggregate values displayed on group headers.

Technically speaking, there's no reason to restrict the resize
feature if the table is empty. Functionally wise, a user could get
confused if the feature is sometimes available, and sometimes not.
For that reason, this commit simply removes the isEmpty condition,
meaning that resizing columns is now always available, even if the
table is empty.

Task 3621490

closes odoo/odoo#146622

X-original-commit: 8fbdbb59eb3f37fad1fb75f4ff363f7fa17e6d27
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-12-18 14:34:25 +00:00
Aaron Bohy 23611e65fa [FIX] web: correctly display domain in field tooltip (debug)
This commit fixes 3 issues with the domain in field tooltips, in
debug mode.

1) it only displayed the domain defined on the field in the model,
 not the domain set in attrs in the view, if any.

2) when the domain was the empty array, `domain: ` was displayed.

3) unset values should not appear in the tooltip (invisible,
 column_invisible, required, readonly).

opw 3455119

closes odoo/odoo#146563

X-original-commit: 8c4ff1fac9eb003c23770bf74f9d7ffe062f6ce7
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-12-18 09:31:44 +00:00
Aaron Bohy 64be692f7e [FIX] web: kanban: always open dialog if quick create fails
Before this commit, when the user tried to quick create a record in
a grouped kanban view (by clicking on the "+" icon of a column, for
instance), and then clicked on the "Edit" button of the quick
create, if the name_create rpc failed, the webclient switched to
the form view and an error was displayed.

The displayed error was about a destroyed component trying to do an
rpc, namely the kanban controller. This is because it does 2 things
when the name_create failed: it opened the form view in a dialog
and it also switched to the form view. The latter was unwanted:
in case of errors, we don't want to switch to the form view but
rather to quick create from a dialog.

The error was actually caused by a small mistake: we use the
record variable to determine if the quick create succeeded and if
we can switch to the quick created record. However, that same
variable was already set before, for another purpose.

OPW 3620671

closes odoo/odoo#146141

X-original-commit: 01bc79051b22f41eff20d860327ed0e41b572cd4
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-12-14 08:00:57 +00:00
Hubert Van De Walle 63a4481ad4 [FIX] web: reset expanded fields on import compatibility switch
Steps to reproduce
==================

- Go to users
- Open the export dialog
- Expand the Groups field
- Add the Groups > Groups/Access Controls field
- Check the import compatibility option
- Expand the Groups field again
=> `TypeError: this.knownFields[id] is undefined`

Solution
========

The expandedFields were not reset. We also need to update the t-key to
take the compatibility state into account.

opw-3378834

closes odoo/odoo#146116

X-original-commit: d2f52abb8ce1b7e5291e0de7d4ea7788f39115bd
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2023-12-13 15:53:00 +00:00
Julien Mougenot 803b4ac29a [FIX] web: do not apply same datetime picker value
Before this commit, the equality check performed by the datetime service
relied on a JSON-strigified version of the value on one end, and on an
array of ISO strings on the other end. This meant that the value was
never equal to itself and that the `onApply` callback would be called
even if the value remained unchanged.

This commit fixes that by ensuring that the compared values have the
same shape.

closes odoo/odoo#145929

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-12-12 23:08:57 +00:00
Bastien Fafchamps (bafa) d5986fb9d9 [FIX] web: Fix readonly modifier not working with clickable option on statusbar field
Before this commit:
The readonly readonly modifier of the statusbar field was not taken into
account when the "clickable" option was set.

After this commit:
Even if the "clickable" option is set to true, if a readonly modifier is
set, it will prevent (or not) changing the stage of a status bar.

closes odoo/odoo#145766

Opw: 3222998
X-original-commit: 9e1d01bc44e5e90ed2b809cfadbd05a5793b3c07
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Bastien Fafchamps (bafa) <bafa@odoo.com>
2023-12-11 18:30:45 +00:00
FrancoisGe 5fb51a7825 [FIX] web: don't save readonly field in unknownCommand
Before this commit, during an onchange, when we received an update command
for an x2many referring to an unknown record on the front end (does not
have a Datapoint Record) during the save, we sent all the contents of
these commands without removing the readonly fields.

In this commit, we're going to filter all the readonly fields according
to the backend (fields). We're not taking modifiers into account because
the command refers to an unknown record, so we don't have the data to
evaluate modifiers correctly.

How to reproduce:
- Go to a form view with an x2many field
- Edit a field that causes an onchange
- The onchange command returns an "update" command for an x2many record
  which is not on the actual page (unknown record) with a value which is readonly
  according to the backend
- Click on the Save button

Before this commit:
  The "update" command doesn't contain the readonly field

After this commit:
   The "update" command contains the readonly field

Task ID: 3607260

closes odoo/odoo#145556

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-12-08 17:19:12 +00:00
Ruben Gomes (rugo) 292dfc20ba [REF] web: nested_sortable_tests
Exports the sortableDrag function, so it can be used in other modules (like account_reports for example).

closes odoo/odoo#145027

Related: odoo/enterprise#50283
Signed-off-by: Habib Ayob (ayh) <ayh@odoo.com>
2023-12-08 15:57:46 +00:00
Prakash Prajapati 37e1e18284 [IMP] web, project, (_todo): add hide_label options in the state_selection in all view
If someone wants to show the label of the state_selection field then
it can be shown

like-
 <field name="xxx" widget="state_selection" options="{'hide_label': False}"/>

task-3475416

closes odoo/odoo#136901

Related: odoo/enterprise#48060
Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>
2023-12-08 15:57:43 +00:00
abd-msyukyu-odoo 6772252c99 [FIX] web, web_hierarchy: ensure proper scroll speed/behavior
In [1], an automatic scroll feature was introduced in order to always scroll to
the bottom of the hierarchy view after each patch.

The `isAnchor` option is removed, because in `Knowledge` it has the side effect
of completely scrolling the article down to the last card of the Hierarchy
view, hiding the rest of the view. Also, that option was not useful in the
standard configuration since there is only one scrollable parent.

Another issue is that the `scroll-behavior: smooth` css property also affects
the scroll speed of the `draggable_hook_builder`, which means that drag scroll
speed is extremely slow and does not follow the speed computed in that file.
This style is therefore removed, and `scrollTo` is refactored:
  - Make use of the native `Element.scrollTo` method, which has a `behavior:
    "smooth"` option.
  - Move and rename methods to compute the closest scrollable from the
    `draggable_hook_builder.js` to `scrolling.js`.
    - They check if a scrollable has a client[Dimension] greater than 0 for
      eligibility.
    - They check the proper `overflow-[axis]` from the computed style (`auto`
      and `scroll` are eligible).
    - A test of `scroller_service_tests` was updated because even if an element
      has `max-height: 0`, its children still can have a height and make their
      scrollable ancestor have a `scrollHeight` greater than its own height.
  - If the `scrollable` option is given to the function and the provided
    element is not actually scrollable, compute a `scrollable` ancestor instead
    of doing nothing.
    - This is more flexible in a situation where a supposedly "scrollable" is
      computed with a selector and ends up not "scrollable" in some custom
      configuration (i.e. embedded view in Knowledge).

The `scrollable` option is removed, since `scrollTo` is already able to compute
the correct closest scrollable element, no need to hardcode a selector for that.

Finally, the draggable speed and threshold for the Hierarchy view are set to
the same values as a Kanban view for user experience consistency.

[1]: https://github.com/odoo/odoo/commit/3489a0d28fdbaf607d18b00d144bb00bae2727c3

task-3562116

Part-of: odoo/odoo#143941
2023-12-07 15:53:07 +00:00
abd-msyukyu-odoo fbac26be7c [FIX] web: get next config for model loaded with values
In `web_hierarchy`, the model is always loaded with values.
However, when a record (component) props are updated, its resId can change (i.e.
if the ordering in the hierarchy view changes), therefore not only the `root` of
the model should be updated with the provided values, but the config should be
reevaluated as well since some record (datapoint) getters use it.

task-3562116

Part-of: odoo/odoo#143941
2023-12-07 15:53:07 +00:00
Julien (jula) ad702c20b1 [FIX] base: call dedicated method for regenerating assets bundles
__Current behavior before commit:__
The logic to regenerate assets bundles is located in the frontend (i.e.
the JS is making the calls to retrieve and unlink them) which is not
very clean.

Furthermore, when doing so, the old assets might still be included on
cached views that called them with `t-call-assets`.

Therefore, regenerating assets bundles can break the CSS or the JS as
long as the view cache is not cleared.

__Description of the fix:__
A new backend method is implemented for regenerating asset bundles.
This provides a dedicated and maintainable approach. Additionally, the
cache is explicitly cleared during the regeneration process.

__Example of steps to reproduce the issue on runbot:__
1. Check `Disable cache` in chrome dev tools.
1. Little bug icon > Regenerate Assets Bundles

closes odoo/odoo#145279

X-original-commit: b8e1f9f880e4723ddbe595043d22b565ad735832
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Signed-off-by: Julien Launois (jula) <jula@odoo.com>
2023-12-07 10:07:58 +00:00
Elisabeth Dickinson 8e1906724c [FIX] web: quick fix to remove ButtonBox overflow on mobile and tablet
Because the number of buttons in the `ButtonBox` isn't dependent on 
the size of each button, sometimes the bar overflows on smaller screens. 

This should probably be redone to calculate the size of each button 
depending on its contents (which can be translatable).
In the meantime, this fixes the overflow issue.

task-3573807

closes odoo/odoo#141163

Related: odoo/enterprise#50256
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-12-06 14:07:49 +00:00
Jorge Pinna Puissant 5940233032 [FIX] web: remove nondeterministic error when waiting for RPC
Before this commit, to be sure to wait for all the RPC are finished
before continue, the clickbot, patched the ORM class and saved in a
waiting list the model and method called, and removed when finished.

The issue with this, is that when calling an ORM with a protected RPC
service (as is the case for the RequestBatcherORM), if the caller
component is destroyed before the return of the RPC, as the RPC service
is protected it will return an always pending promise, and the RPC will
never be removed from the waiting list and the clickbot will wait
indefinitely.

Now, we use the RPC event directly, so even if the component is
destroyed, we know that the RPC was finished, and is removed from the
waiting list.

Note that, this commit doesn't have a test, making a test for this case
is quite difficult, and some of the causes of the issue will be removed
in future versions.

closes odoo/odoo#145081

X-original-commit: c444255004d37f5153de24d938a4b7bc4497e858
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-12-06 09:53:22 +00:00
Abdelouahab (abla) 11a81bf88b [FIX] web: check children instead of childNodes
To reproduce
============
on time Off -> allocations, open a record and try to open studio
-> Owl Traceback

Problem
=======
the ButtonBox is not well compiled, we check if it has children
using `!el.childNodes.length`, but this property returns the total
number of child nodes, including text nodes ...
So counting text nodes, we proceed to create ButtonBox node and fill it
with children `for (const child of el.children)`, but the property `el.children`
doesn't take into account text nodes, which leads to return `''` then a null object

Solution
========
as we loop on `el.children` the check must be done using the same property.

opw-3603952

closes odoo/odoo#145080

X-original-commit: e9e8626c7dabd2d0ba51390279e5adb1eb3aef6f
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-12-06 06:58:52 +00:00
Sébastien Theys 4d00cedaca [FIX] mail: fix race condition in "make voice message in chat"
runbot-46626

closes odoo/odoo#144901

Signed-off-by: Didier Debondt (did) <did@odoo.com>
2023-12-05 21:15:22 +00:00
Jorge Pinna Puissant c7b07f4ec5 [FIX] web: avoid closing dropdown outside the active element
When a dropdown open a dialog and on the dialog there is a new dropdown,
before this commit, when clicking on the second dropdown, the first one
will close.

This is an issue with closing the first dropdown, is if the dialog is
opened using useOwnedDialogs, the dialog will also close.

Also, if the dialog is open to throw a "find more" of a x2many field,
even if the dialog is not close, as the dropdown will close, the
original field will also be destroyed and it will raise an error.

Now, we avoid closing dropdown's, when opening new dropdowns that there
are not on the same active element.

opw-3464528

closes odoo/odoo#144238

X-original-commit: 6fec387d258dfd945dbbd48a9aab91ce6113ccaa
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-12-04 15:10:30 +00:00
Mathieu Duckerts-Antoine 167999c350 [FIX] web: pivot: no duplicates in read_group groupby
Since https://github.com/odoo/odoo/pull/103510, the read_group parameter "groupby" can no longer contain
implicit duplicates. For example groupby=['date', 'date:month] doesn't work
anymore. Here we remove all duplicates from groupby before making a read_group.

closes odoo/odoo#143792

Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2023-12-04 15:10:29 +00:00
Elisabeth Dickinson 28b0168463 [IMP] web: truncate date in list view
When the width of the column is too small to fit the date, the date was
cut by the following column instead of having its content
truncated. This could be seen on the "Creation date" in the list view of
Sales Quotations.

task-3463329
part of task-3326263

closes odoo/odoo#144039

X-original-commit: b9675c38b49d99e00e401dbdb90445354aab43c3
Related: odoo/enterprise#51684
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-12-04 11:58:16 +00:00
Aaron Bohy 39874b0e9c [FIX] web: tests: make mock fetch almost sync (micro-tick)
Before this commit, a studio qunit test ("edit/delete menus")
sometimes failed on runbot, because it tried to click on a button
in a modal footer, but it found 3 of them, because another dialog
which was expected to be closed at that moment, was still opened.

There was no guarantee for the dialog to be closed because of the
way browser.fetch was mocked. The fetching part was ok, but the
function returned a Response object, whose `json` method is async
(setTimeout-like async, i.e. "real" ticks).

This commit mocks some functions of the returned Response instance
to ensure that, by calling nextTick after a click or whatever, the
fetch operation has been done, the body has been decoded, potential
renderings are finished and the DOM has been patched.

Runbot error 23054

closes odoo/odoo#143980

X-original-commit: 66ef3ae730a233dc510425e0a5baca2973de493e
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-11-30 10:13:23 +00:00
Julien Carion (juca) 05eea6dfc1 [FIX] web: kanban: missing quickcreate button in empty kanban
This commit fixes an issue where the quickcreate button was missing from
the kanban view when it was grouped by a non many2one field and contained
no record yet (so that no column is shown yet).

Steps to reproduce:

-Go to a kanban view on a model with no record
-Group by as scalar value (eg: Description)
->The "New" button disappears

OPW-3459808

closes odoo/odoo#143793

X-original-commit: 112ba1cb64b5170fdefd267de8e765f87b444b56
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Julien Carion (juca) <juca@odoo.com>
2023-11-30 03:03:58 +00:00
Tom De Caluwé 48634a2adf [FIX] web: avoid week number calculation errors
When opening the calendar view in, for example, the timesheets app, the first
day of the week used for the number calculation is provided by the localization
service, which in turn requests it from the database. Because the first day of
the week is stored as a number between 1 and 7 in the res.lang model and a
value between 0 and 6 is expected by the DateEnv, offset errors can occur.

The error is fixed in various components (for example, the CalendarDatePicker
and CalendarCommonRenderer) but not in others (CalendarYearRenderer). Instead
of patching each component separately, a better solution is to require the
CalendarModel to expose a 0 to 6 firstDayOfWeek value as part of its public
interface.

opw-3389617

closes odoo/odoo#142056

X-original-commit: aea22a46515304df41dfaf427f5955824fe342f5
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-11-28 21:20:48 +00:00
Mathieu Duckerts-Antoine 2b80c8e647 [FIX] web: pivot: clear sortedKeys when pruning
Due a typo, sortedKeys were not always cleared when pruning the
new trees after an update. Consequently the method _getTableRows could be
called on a inexisting sub tree. Here we simply fix the typo and a test.

opw-3584675

closes odoo/odoo#143714

X-original-commit: 3fa2d6e418daa2b1fa0df3c8d1ca643fac4cbaa2
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-11-27 09:51:11 +00:00