Commit Graph
4240 Commits
Author SHA1 Message Date
Pierre Pulinckx (pipu) 7b1dd79f46 [FIX] web: localize date/datetime in domain descriptions
The date/datetime values produced in the domain selector for
date/datetime fields are not localized (like they are in the date
picker) when presented in :
- the domain selector in readonly mode
- the facets edited/created from the domain selector dialog
Here we make sure that the localization parameters are used when we
display date/datetime values in the domain descriptions.

closes odoo/odoo#141304

X-original-commit: bd1f5dc017a2549889002d5ff5382cbd3be6580b
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-11-07 21:02:26 +00:00
Pierre Rousseau d8efcd383f [FIX] web: correctly apply invisible attribute on button box
Steps to reproduce:
- Create a form view with a `div` with class `oe_button_box` and an
  invisible modifier inside a `sheet` tag
- Open the form view

=> The invisible modifier is not applied on the button box.

Since https://github.com/odoo/odoo/pull/116641, the invisible modifier
set on a button box inside a sheet tag is **replaced** by a condition
that check if the form is displayed in a dialog. This is not correct,
the invisible modifier should be **extended** with the dialog condition.

closes odoo/odoo#141259

X-original-commit: 570a1a9bf3e7c3012c516beb8850f320a6cc8f63
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-11-07 21:02:16 +00:00
FrancoisGe 5674e221c4 [FIX] web, *: clicking on a button that crashes does not enabled buttons
In many situations, when you click on a button, you want to disable all
the other buttons while it is running.
Currently, in each of these situations, we duplicate the same code that
disabled all the buttons and enabled them afterwards. Unfortunately, in
many cases, if the code executed crashes, the buttons are not enabled.
In this commit, we're going to create a helper so that we have a single
version of the code that correctly handles crashes. This helper will
disabled all the buttons, then execute the click code and enabled all the
buttons afterwards. If the code crashes, it will also enbaled them.

The problem has been reported for the Settings Form view:
When you edit this view and click save, if an error occurs in the save,
all the buttons remain disabled.

closes odoo/odoo#140938

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-11-07 19:32:17 +00:00
Pierre Rousseau e4b66668e0 [FIX] web: do not use command "set"
In a many2many_tags field with onchange and on a slow network, quickly
add or remove tags several times. Each call to update sends a command 6
(SET) based on the current state of the record (typically here,
the very initial state). For example, if there're 2 tags [1, 2] in the
relation and I add 3, a command 6 with ids [1, 2, 3] is sent. If I
quickly add 4 before the onchange returns, another command 6 with ids
[1, 2, 4] is sent. At the end, 3 would not have been added to the
relation.

With this commit, we don't use the command "set" anymore. Instead, we
use a combinaison of commands "link" and "unlink" to add and remove
records from the relation. This way, we don't need to know the current
state of the record, and we can be sure that the final state of the
relation is the one we expect.

Task-id 3522153

closes odoo/odoo#140644

Related: odoo/enterprise#49995
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-11-07 17:57:14 +00:00
Jorge Pinna Puissant 85a1148a71 [IMP] web: remove autoresize function from dom.js
closes odoo/odoo#141125

Part-of-task: 3439226
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-11-06 13:58:44 +00:00
Pierre Pulinckx (pipu) ebe64aafac [IMP] web: make model reload silent
When a request to the server takes more than 3 seconds, the blockUI
then prevents the user from taking another action. For example, when
you want to apply several filters quickly, the blockUI appears and,
in the end, you may want to apply yet another filter.
In this commit, we remove the blockUI because we believe that blocking
the user makes little sense. This only makes sense when installing
a new application.

task-3279095

closes odoo/odoo#140042

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-11-06 13:58:38 +00:00
Jorge Pinna Puissant f51a6a8f54 [FIX] web: clickbot hard-coded date in tests
This commit, fix the issue that some tests fails on other month than
October, this occurs because the current date wasn't patched on the
tests.

Moreover, this commit removes the log "Clicking on: Control Panel menu",
this log is not very important, and can increase significantly the size
of the log.# with '#' will be ignored, and an empty message aborts the
commit.

closes odoo/odoo#140728

X-original-commit: 3538513c87098aab21bd2224fbf6a338ffd5b577
Related: odoo/enterprise#50046
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2023-11-06 11:16:34 +00:00
Bruno Boi f9753a3e71 [FIX] web: fix popover in dialog with useAutofocus
**Before this commit**
Open within a dialog a popover that has a child
using the useAutofocus hook.
As the dialog has become the UI active element,
and as the popover's element tree is a sibling
of the dialog element (since both use the overlay
service): the autofocus mechanism wanted by the
popover's child does not work at all.

**After this commit**
The popovers now can also become the UI active
element, leading to the above use case to work properly.

closes odoo/odoo#140885

Signed-off-by: Florent Dardenne (dafl) <dafl@odoo.com>
2023-11-04 16:38:53 +00:00
Bruno Boi 003609b8d2 [IMP] web: soften the UI active element takeover
**Good to know first**
The UI active element takership system is
directly bound to the focus trap mechanism.

**Before this commit**
If an element become the UI active element but has no
tabable elements in its tree, we force its tabindex
to the -1 value to make it programmatically focusable.
That way we ensure the focus is effectively trapped.

**After this commit**
The tabindex is no more forced at all.
Instead, if we detect that there are no tabable elements
inside the UI active element candidate, it simply does not
become the UI active element.
In other words, this commit kind of weakens the focus trap.
But this is perfectly fine for our use cases, i.e.:
- dialogs always have at least one focusable button (close, ok...)
- the website wysiwyg-adapter has a ton of focusable elements

**Why ?**
We need this change to permit other UI pieces to make use of
the active element takeover mechanism, i.e. popovers.

Part-of: odoo/odoo#140885
2023-11-04 16:38:53 +00:00
Bruno Boi bf2866a27c [FIX] web: trapfocus if first/last tabable changes
**Before this commit**
If a UI active element taker has its first or last
tabable element rendered conditionnaly, the focus trap mechanism will
not work properly.

**After this commit**
It works as intended.

Part-of: odoo/odoo#140885
2023-11-04 16:38:53 +00:00
Mathieu Duckerts-Antoine d30729c6cb [FIX] web: condtion tree: keep expressions
Before this fix, a condition of the form (field_name, "in", expr) would
be "stringified" in such a way that expr would be wrapped in a list, e.g.
we would get by expressionFromTree the expression
field_name in [expr]
Here we prefer to keep expr as it is since we have no information on its
type at evaluation. That is we transform the above condition into
field_name in expr

closes odoo/odoo#140966

Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2023-11-04 06:43:19 +00:00
Mathieu Duckerts-Antoine 04753f4d42 [REF] web: use evaluateBooleanExpr in a test
Part-of: odoo/odoo#140966
2023-11-04 06:43:19 +00:00
Julien Carion (juca) 924a797a3b [FIX] web: domain field: foldable invalid domain
This commit fixes an issue with the domain field where a traceback would
be launched when an invalid domain is received. It also changes how
invalid domains are displayed in foldable domain fields so that only the
content of the domain selector component is displayed in this case.

closes odoo/odoo#140719

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-11-04 00:38:32 +00:00
Julien Carion (juca) 058117c333 [FIX] web: domain field: validate domain when edited in debug
This commit changes the behavior of the domain field such that it
performs a quick validation of the domain after it has been edited in
the debug input. This solves an issue where the isValid state was not
properly updated after debug input edition.

Part-of: odoo/odoo#140719
2023-11-04 00:38:32 +00:00
Sébastien Theys 06603e9dc7 [FIX] mail: show translations for emails
Due to shadowRoot, emails were not properly translated.

closes odoo/odoo#140847

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2023-11-03 00:49:06 +00:00
Christophe Monniez 7094215e65 [FIX] web: skip clickbot qunit test
The clickbot test fails after October because of a hard coded month. It
needs to be refactored but let's skip it in emergency.

closes odoo/odoo#140641

X-original-commit: f9ec63dc3d865a24ec7da3f9389ce6b46fb66a83
Related: odoo/enterprise#49990
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2023-11-02 10:15:05 +00:00
Aaron Bohy 4dc211dff8 [FIX] web: display filters directly in search bar
In views with a searchbar, we want the filters to be displayed
directly when they are activated, without waiting for the view to
be reloaded. This is to provide a direct feedback to the user.

Before this commit, this didn't work in grouped kanban view with
progressbar. The regression has been introduced by [1] which moves
the progressbar logic out of the model. With [1], the rendering of
the KanbanController waits for the progressbar data to be loaded
in onWillUpdateProps, thus delaying the rendering coming from the
WithSearch when a filter is toggled.

This commit applies the same logic as for the model: we do not wait
for the loading promise in onWillUpdateProps. That way, the
rendering coming from WithSearch is synchronous, but a reload is
initiated and another rendering will be scheduled by the Controller
itself when the data will be loaded.

This commit also adds a test for the model case, as it appears that
this wasn't tested.

[1] 58ca40b032

closes odoo/odoo#139967

X-original-commit: 47cf6e326f5a795984bac2138b169503c3dd099c
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-31 10:33:51 +00:00
FrancoisGe f534d1cccf [FIX] web: x2m editable in line and dialog
Purpose:
-------
The "StockMoveX2ManyField" custom field has given rise to a new need,
that of being able to edit a record in an x2many directly or from a dialog.
This is the first use case to require the ability to do both at the same time.

This particular use case highlighted a bug preventing a change from being saved.

How to reproduce:
- Go to a form view with an x2m using a custom widget
- Open an x2m record in dialog mode
- Close the dialog
- No changes have been made to the record, so the save button is not displayed
- Edit a field in the same record

Before this commit:
    The save button is not visible

After this commit:
    The save button is visible.

closes odoo/odoo#140298

Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-10-30 15:18:02 +00:00
Michael (mcm) d8c0373f33 [IMP] web: link popover together
Before this commit, cliking on a popover that was open inside another
popover closed both of them.
After this commit, the popovers are not closed. them will close only if
we click out of them and the popovers they opened.

closes odoo/odoo#140258

Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2023-10-30 15:17:59 +00:00
FrancoisGe 64037d03d0 [FIX] web: FormStatusIndicator flickering
Purpose:
--------
Before this commit, if you edit a char field with an onchange in
an x2many, the FormStatusIndicator buttons will flicker.

How to reproduce:
-----------------
- Go to a form view with an x2many field in list mode
- Type a char in the char field of a record
- The FormStatusIndicator buttons are visible
- Click outside the char field
- An onchange is triggered

Before this commit:
    The FormStatusIndicator buttons will disappear until the onchange returns.

After this commit:
    The FormStatusIndicator buttons remain visible.

closes odoo/odoo#140179

Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-10-30 13:56:01 +00:00
Pierre Pulinckx (pipu) e179fce25c [FIX] web: graph: sort tooltip content
Tooltip items are not correctly sorted anymore after migration to last
Chart.js version in the commit eb530b83b06a057f96.
This feature is fixed in this commit.

task-3552948

closes odoo/odoo#139676

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-30 12:05:20 +00:00
Julien Carion (juca) 0c7e7e12af [IMP] web: edit domain button is available while loading records count
This commit removes the requirement that the records count should be
set before the edit domain button is shown for domains which must be
edited in a dialog. This could be annoying in cases the records count
loads slowly.

task-3561782

closes odoo/odoo#139969

X-original-commit: f2ba825eac5e4bda3d1b1d3676a1b737701c0fb8
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
Signed-off-by: Julien Carion (juca) <juca@odoo.com>
2023-10-30 09:00:58 +00:00
c0b683e2f4 [IMP] web,*: improve darkmode
This commit introduces some adjustments to the dark mode color scheme
and the use of bootstrap classes in Community.

- Mini calendar contrast -

The colors were not using variables, making them non dynamic
and breaking the contrast in dark mode.

- Avoid !important rules spreadsheet -

Prior to this commit, spreadsheet top bar was using a `bg-white` class,
making it pure black in dark mode.

Since spreadsheet is designed with light colors and we don't provide a
dark mode for it, we remove that class and set a `background-color`
property using CSS in Enterprise.

- Input color -

This commit fixes the focus behavior on the searchbar in the control
panel, the `command_palette_search`, and the `start a conversation` in
discuss.

- Copy clipboard field border color -

Make use of the `text-primary` color for the copy to clipboard field
We use the o-theme-color function to avoid an undefined since primary
doesn't exist in the o-theme-text-color map in white mode.

- Web_editor toolbar variables -

The toolbar was using the `o-brand-primary` variable
which was set to a darker shade. This caused issue when activating an
option due to how vibrant the color is.

- Improve the controls on border-color -

Introducing a custom property on the border-color to allow
further control on individual components (such as the popover).

- Improve setting tabs colors use -

Prior to this commit, the colors of the settings tabs menu were kinda
inverted. The menu was light in dark mode and dark in light mode.

We fix this by changing the values associated to the CSS variables in
use.

- Make model field selector dark mode proof -

Fixing the design of the model field selector popover in both
light and dark mode. Since the popover was using custom style with
arbitrary values, it was not designed for the dark mode and had a lack
of consistency.

To improve the design, we use variables rather than custom style, and
make sure the desired render is as close as before.

- Sign colors use -

This commit aims to improve the sign module in both light and dark mode.
There were some readability issue with some `btn-light` having poor
contrasts in both light and dark mode, and the use of some classes was a
bit unexpected (e.g `card-header` to set a grey background with some
padding).

- Improve buttons design inside listview -

Prior to this commit, this button was using custom CSS to make it look
like a primary button, while it was using classes related to secondary
buttons.

We remove the custom CSS used to style it correctly and keep our button
design consistent.

- Messaging menu layout in mail -

This commit aims to improve the design of the notifications displayed
in the messaging menu. Prior to this commit, the notifications dropdown
was using custom CSS variables overriding the regular behavior
of our dropdowns.

In fact, the layout was generating some friction:

1) Marking a notification as read would turn its background into a
darker color

2) Effects like `:hover` were all based on the custom CSS variables
resulting in an inconsistent layout.

- Multi company selector adaptations -

In darkmode the multi company selection was using the btn-light which
creates a weird effect and overrides the dropdown default hover behavior

This commit uses the btn-link to display an hover effect on the
company switch and on the checkbox while blending with the background
and the default dropdown hover effect.

- Adapts default badge design -

Improve the design of the default badges in dark mode.

If you open the light mode, these badges are dark grey with a white
text. If you switch to dark mode, they are dark grey but with a dark
text, which makes them look either muted or off.

We make use of SCSS variables to handle the color of the component,
providing a good styling in both modes.

- Fix kanban cards borders inside dropdown -

Fixes the issue with the divider inside the kanban dropdown menu not
showing in dark mode.

To ensure it is visible, we assign it the `$dropdown-divider-bg`, which
is the color it should use, as the horizontal divider above uses.

- Fix tour pointer design for dark mode -

This commit aims to insert the tour pointer and its content inside the
styling we applied to our tooltip.

To do so, we make sure it uses CSS variables, allowing more control and
consistency, plus we replicate the overall look of our tooltips.

- Fix `text-primary` on action background contrast -

This commit improves the readability of our `text-primary` classes when
it's used on a `$o-component-active-bg` background.

Prior to this commit, the `text-primary` was not meeting the contrast
standard, mainly when you were using the `CMD+K` shortcut on the
app switcher.

To prevent that, we changed the background to a `$o-component-active-bg`
background with an opacity ensuring our text provides a good contrast.

- Fix input states -

Prior to this commit, the `--o-input-border-color` CSS variable was
using the `$o-form-lightsecondary` variable to define the standard color
of the `border-bottom` property of our inputs.

This was conflicting since `$o-form-light-secondary` is also used to
define the `background-color` of our table on focus.

With this commit, we separate these two element with different variables
to make sure they don't affect each others.

- Fix kanban ghost background -

Before this commit, if you created a project without any stage or element
in it, the ghost cards that act like placeholders would be pure `#000` in
dark mode, due to the `bg-white` class.

This commit replaces that class with a `bg-light`, providing a better
visual result in both light and dark mode.

- Fix new message design -

Improve the design of the new message element while
inside Discuss, using our danger color, ensuring a good visual result in
both modes.

task-3201038

closes odoo/odoo#139966

Related: odoo/enterprise#49666
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Co-authored-by: chgo-odoo <chgo@odoo.com>
Co-authored-by: stefanorigano <sri@odoo.com>
2023-10-28 10:07:53 +00:00
Mathieu Duckerts-Antoine 0ff280ec6d [IMP] web: ExpressionEditor: better conversion of in/not in operators
When foo is not an x2many, a condition of the form
("foo", "in", [])
was transformed by the ExpressionEditor into
"set([foo]).intersection([])"
while it can be better expressed as
"foo in []"

In this commit, we improve the conversion of conditions of that kind and
similar other conditions.

Note that we also ideally want domains and their corresponding expressions
to be evaluated the same ways on records (at least on good examples).
For this we want for instance, the condition
("foo", "in", 1)
to be translated to
"foo in [1]"
and not
"foo in 1"
which is an invalid Python expression.

closes odoo/odoo#140140

Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2023-10-27 21:36:53 +00:00
FrancoisGe 5696b5686e [FIX] web: select all records should trigger only one rendered
Purpose:
--------
From the new RelationalModel (odoo/odoo#114024), in the list view, when
all the records are selected, the ListController is rendered once per record.
This causes performance problems and can cause a flicker where each record
is selected one by one.

Why:
----
When selecting all records, we will call record.togggleSelection() on each
record but this function uses a mutex. So each record will be selected
asynchronously. As the state is not modified by the same tick,
a rendering will be triggered for each call to record.togggleSelection.

Solution:
---------
Add a togggleSelection function to the DynamicList which will select all
the records in the same mutex. The state will therefore be modified in
the same tick and there will be a single rendering.

closes odoo/odoo#139859

Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2023-10-27 20:16:02 +00:00
Julien Mougenot 43640ceb1c [FIX] web: use same date in object test
Before this commit, a test in the "objects" test suite failed because
the 2 dates generated to verify equality could potentially be created
in a different millisecond, which would make the test fail.

A first fix simply assumed that patching the date would suffice, but
this did not solve the issue since the time advances normally even for
patched dates.

This fix ensures that the dates have exactly the same values (and
removes the patch which was not necessary anyway).

Runbot task 25596

closes odoo/odoo#139953

X-original-commit: b02d7fe6c4eaee09066cf58d0e9bad91e3a3234d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2023-10-27 13:02:22 +00:00
Renaud Thiry 044cd8af7b [FIX] web: update reference resModel with props
When ReferenceField uses an M2O field. The model is not updated along
with the props when the model field is updated.

Because of this, the onWillUpdateProps hook will keep trying to update
its value. This results in an infinite render loop.

task-3248500

closes odoo/odoo#139954

X-original-commit: f8f6aaa5e32967d6c7cd888fbe574acdc6f79dc6
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Renaud Thiry (reth) <reth@odoo.com>
2023-10-27 07:14:45 +00:00
Rémy Voet (ryv)andPolymorphe57 e6f501bea5 [FIX] web: fix domain_selector to handle false as display_name
Since https://github.com/odoo/odoo/pull/137098, `display_name`
can be false (from the default behavior in BaseModel). It isn't
handle correctly in domain_selector Component, which trigger a
traceback trying to `split` false.

closes odoo/odoo#139450

X-original-commit: 06f3cbb95b2e4cfb271039a19660991c743c2ba8
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
Co-authored-by: Polymorphe57 <dam@odoo.com>
2023-10-26 13:41:14 +00:00
Bastien Fafchamps (bafa) 37ab6ff1b5 [IMP] web: Company service refactor and improved ease of understanding
This commit improves the company service to be more readable. Variables
have been renamed to better indicate what they represent. Jsdoc has
also been added to further improve the ease of understanding of the service.

The following have been renamed:

- `allowedCompanies` -> `activeCompanies`
- `nextCompanies` -> `selectedCompanies`
- `logNextCompanies` -> `applySelectedCompanies`

The SwitchMenu & SwitchMenuItem components have also been simplified by
making use of useState on the company service itself.

Indent has aslo been added to SwitchMenuItem on mobile to display the
hierachy of companies.

closes odoo/odoo#138521

Related: odoo/enterprise#48862
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-26 13:41:05 +00:00
Adrien Dieudonné e6c747b43b [REF] *: keyboard: replace deprecated charCode, keyCode and which properties
These properties are deprecated.

We should consider to use `KeyboardEvent.key` or `KeyboardEvent.code` for new code.
Note that we prefer to use the `key` property as multiple physical keys
can send the same value (e.g. Enter can also be sent by the numeric pad).
We should only use `code` when we explicitly want to target a single physical
key on the keyboard.

By doing this, we can now remove the dependency of `jQuery.ui.keyCode`
that was used as mapping of key code descriptions to their numeric values.

References:
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/charCode (deprecated)
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode (deprecated)
https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/which (deprecated)

https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key

https://api.jqueryui.com/1.12/jQuery.ui.keyCode/

Some links that helps:
https://w3c.github.io/uievents/tools/key-event-viewer.html
https://www.toptal.com/developers/keycode/table

closes odoo/odoo#139809

Related: odoo/enterprise#49591
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-10-26 08:46:00 +00:00
Pierre Paridans 963842381e [IMP] web,*: replace ClipboardJS with Web API and homebrew polyfill
*: auth_totp_portal, mrp_subcontracting, project, survey, web_editor,
   website, website_links, website_sale_loyalty, website_slides, test_lint,
   spreadsheet

Implements missing `clipboard.write()` and `ClipboardItem` ; targets
only Firefox (which partially implements Clipboard API, features hidden
behind a preference flag).

Supported browsers: Chromium 76+, Safari 13.1+, Firefox 63+, Safari iOS
13.4+.

This allows to replace ClipboardJS by the native Clipboard Web API.

Reference:
https://caniuse.com/?search=clipboard
https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API
https://w3c.github.io/clipboard-apis/

task-3439226

closes odoo/odoo#134881

Related: odoo/enterprise#47154
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-10-26 07:22:54 +00:00
Julien Carion (juca) 1693fee3db [REF] web: remove orm service nameGet
This commit removes all usages of the nameGet method of the orm service
following changes introduced by https://github.com/odoo/odoo/pull/122085

task-3377209

closes odoo/odoo#139727

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-25 20:56:10 +00:00
Valentin Chevalier e3fe2b01f1 [IMP] web,sale: allow selection widget in kanban view
Currently, users who want to change the visibility of product's
documents need to open their form view and edit it.

The selection widget now allows users to quickly edit the way a document
is displayed to their customers from the product's documents kanban view.

Part-of: odoo/odoo#137975
2023-10-25 18:10:55 +00:00
Mathieu Duckerts-Antoine 39e5124170 [IMP] web: support set intersections in condition tree
Now that some field attributes like invisible are given by Python
expressions that can involve set operations, we want to be able to easily
edit those expressions in the expression editor. For this we have to
improve a bit the mapping expression <-> condition tree, in order to
have simple rewrittings like
"set(user_ids).intersection([1, 2])" <-> condition('user_ids', 'in', [1, 2]).

Part-of: odoo/odoo#139451
2023-10-25 17:03:19 +00:00
GorashandMathieu Duckerts-Antoine febece1371 [IMP] web: py_js: support of set and some set operations
We make py_js support sets and the operations intersection, union, and
difference.

Part-of: odoo/odoo#139451
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
2023-10-25 17:03:19 +00:00
Mathieu Duckerts-Antoine 55e1a4546e [FIX] web: py_js: improve evaluation of bool
The evaluation of some expressions involving bool like "bool()" were wrong.
We fix that and add some tests.

Part-of: odoo/odoo#139451
2023-10-25 17:03:19 +00:00
FrancoisGe 2f0e7d5822 [FIX] web: KanbanRenderer is rendered twice
Before this commit, the KanbanRenderer was rendered twice.

Why:
---
The "getGroupsOrRecords" function used in the KanbanRenderer templace
uses the "sort" function on "list.groups". The "sort" function modifies
the array on which it is called, which will generate a rerender because
"list.groups" is reactive.

Solution:
---------
Call the "sort" function on a clone of "list.groups".

closes odoo/odoo#139547

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-24 15:23:31 +00:00
Pierre ParidansandAaron Bohy feaa6d64bd [FIX] web: tests: click helper: throw error if target is disabled
This commit is a backport of odoo/odoo@f065276a46

Before chrome 116, programmatic clicks on disabled buttons weren't
actually fired. With chrome 116, they are. As a consequence, some
tests fails on chrome 116 because they click (on purpose) on
disabled button to highlight the fact that nothing happens.

This commit improves the click helper to make it throw an error
when the target is disabled. It also adapts the tests that were
clicking on disabled button, in general to simply assert that the
button is disabled instead.

closes odoo/odoo#139537

X-original-commit: 0e8b50d540c9eee0837282883d603937b94b2fd2
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2023-10-24 15:23:28 +00:00
Jorge Pinna Puissant 54ae8f96cc [FIX] web: clickbot test modal menus
Before this commit, the clickbot avoid testing modal menus.

Now, the clickbot open and closed the modal menus.

task-id 3535596

closes odoo/odoo#139389

X-original-commit: 60e16f1e32a0e1448c91826ec06c1e0e8a7bb1fc
Related: odoo/enterprise#49352
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-10-24 13:55:20 +00:00
Aaron Bohy a4069e25b6 [FIX] web: CodeEditor: do not notify value props updates
Before this commit, the CodeEditor component called the `onChange`
props function each time the ace library fired the `change` event.
This in particular happens the value of the editor is set
programmatically by a update of the `value` props. Worse, in that
case, the event is fired twice: once with the empty string, and
one with the new real value. This isn't what we want for the
CodeEditor API. We only want to notify the parent of updates done
by the user in the UI. This commit thus filters out the noisy
`change` events fired by ace.

This fixed an issue with the ResourceEditor of the website: select
a scss or js custom resource, click on Reset: the resource is
marked as dirty, because `onChange` is called when the CodeEditor
is updated with the new value.

closes odoo/odoo#139154

Related: odoo/enterprise#49286
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2023-10-24 12:38:30 +00:00
Aaron Bohy 87c6dde49d [REF] web,*: SearchDropdownItem becomes CheckboxItem
Before this commit, there was a special kind of dropdown item
defined in the search/ folder, named SearchDropdownItem, which was
basically a DropdownItem but with role "menuitemcheckbox" instead
of "menuitem". It allowed to displayed a check icon in front of
values to indicate that they are selected. It is used especially
in the search menu, to indicated which filters/groupbys/favorites
are active.

This specific item is used in other context that search (e.g. pivot).
A similar usecase has also been introduced in website, in the
ResourceEditor (the wowl version of the AceEditor).

This commit thus moves the component to web/core/dropdown and
renames it into CheckboxItem.

Part-of: odoo/odoo#139154
2023-10-24 12:38:30 +00:00
Aaron Bohy 28d85defa5 [REF] web: remove useWidget compatibility helper
Now that the last Component using that helper have been fully
converted to Owl (AceEditorWrapper -> ResourceEditor), we can
remove it.

Part of task~3439226

Part-of: odoo/odoo#139154
2023-10-24 12:38:29 +00:00
Aaron Bohy fddb78a2af [IMP] web: SelectMenu: add autoSort props
By default, the SelectMenu component alphabetically sorts the
choices. Before this commit, this wasn't avoidable. As there's now
a usecase of SelectMenu where we want to enforce a specific order
on the choices (the website AceEditor), this commit introduces a
props `autoSort`, which is `true` by default, but which allows to
disable the sort.

Part-of: odoo/odoo#139154
2023-10-24 12:38:29 +00:00
Aaron Bohy fff1fa0392 [IMP] web: add initialWidth props to ResizablePanel
This props allows to specify the initial width of the panel, whereas
before the initial width was the minimal width, i.e. the user could
only expand the panel, not shrink it.

Part-of: odoo/odoo#139154
2023-10-24 12:38:29 +00:00
Aaron Bohy 4b79bbff82 [MOV] web: move ResizablePanel component to web
This component has been introduced in web_studio. We have now a
similar usecase in website, for the AceEditor component. We thus
move the component definition to web.

Part-of: odoo/odoo#139154
2023-10-24 12:38:29 +00:00
mano-odoo 88e75fd5cd [FIX] web: taglist hide avatar overlay in readonly
The avatars coming from the TagsList component could not differentiate
if the `Many2ManyTagsAvatarField` was in readonly. Displaying an hover
state style when in list view.

This commit checks if the tag.onDelete is defined to render the span
containing the hover effect.

task-3514404

closes odoo/odoo#139455

X-original-commit: ac1757d96ab9ddda934b9b49ad41d83c9567e5b8
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-24 11:10:09 +00:00
Leonardo Pavan Rocha 9086ef0296 [FIX] web: fix calendar view tests after revamp
This commit fixes breaking calendar view tests after the revamp done in
task-3455051 and task-3389317.

task-3455051
task-3389317

Part-of: odoo/odoo#138670
2023-10-23 20:07:23 +00:00
Leonardo Pavan Rocha ec3e3c3379 [IMP] web: save sidebar state in session storage
This commit adds the feature of saving the calendar state in the user’s
session storage. This allows the user to refresh the page and the sidebar will
be hidden/shown depending on what is saved in the session storage.

task-3455051
task-3389317

Part-of: odoo/odoo#138670
2023-10-23 20:07:23 +00:00
Leonardo Pavan Rocha 9ffaaab0d3 [IMP] web: popover service prevent click away to cause a click event
Currently the popover service is closed when you click away from the popover.
However, it’s not expected that the click event that closes the popover,
triggers another click event. This was causing a frustrating issue in calendar
where you would close the popover by clicking on the calendar, and it would
open the “new event” form view. The solution is to prevent default when
closing the popover.

task-3455051
task-3389317

Part-of: odoo/odoo#138670
2023-10-23 20:07:23 +00:00
Leonardo Pavan Rocha 6e4ba770f6 [IMP] web: show date information in calendar header
This commit adds date information in the calendar header depending on the
scale that is being rendered. E.g. in yearly view, we show the year; in
monthly view, we show the month and year; in weekly view, we show the month,
the year and the week number; in daily view we show the day, the month and the
year.

task-3455051
task-3389317

Part-of: odoo/odoo#138670
2023-10-23 20:07:23 +00:00