Commit Graph
15669 Commits
Author SHA1 Message Date
Abdelouahab (abla) d7da674803 [FIX] web: keep unchanged values in datetime fields
To reproduce:
============
- on Planning create new shift
- select a template
- change the end date
-> the end date is reset to the template value

Problem:
========
- `end_datetime` and `start_datetime` have the same compute method
- `template_id` depends on `start_datetime` and `end_datetime`
- so changing `end_datetime` triggers the compute method of `template_id`
that will read `start_datetime`
- reading `start_datetime` triggers the compute method of `end_datetime`,
that will check if `template_id` is set and if so, will take its values
-------
 why the compute method of `end_datetime` is triggered ? :

-------
- `start_datetime` is not protected from recomputing, at this
line : https://github.com/odoo/odoo/blob/saas-16.3/odoo/models.py#L6746
we only protect the fields sent by frontend (only `end_datetime`)
- frontend doesn't send `start_datetime` as it was not changed

Solution
========
as ORM fix can't be made in stable, we send `start_datetime` in the `onchange`
query even if it's unchanged to make sure both fields are protected

opw-3693206

closes odoo/odoo#155705

X-original-commit: 7081372e721387da983621b3dd2986ae0872e4c8
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Abdelouahab Laaroussi (abla) <abla@odoo.com>
2024-02-29 08:57:57 +00:00
Aaron Bohy d111e66525 [FIX] web: kanban progress bar: display correct aggregates
Before this commit, in a grouped kanban view with progressbars
and an aggregate field, after clicking on a bar to filter
records, the aggregate value was always 0 (at least when grouped
by a many2one or date(time) field).

This was due to a mismatch when trying to find the value of the
aggregate in the web_read_group result, as when grouped by a date
or datetime field, the key is `fieldname:granularity`, and we were
looking for the fieldname only. And for the many2one case, we were
comparing a pair [id, display_name] with an id.

This commit fixes the issue. It also fixes the mocked version of
read_progress_bar in the MockServer, s.t. we can correctly
reproduce the scenario in tests, as in the previous version, keys
in the returned object weren't computed the same way as in the real
read_progress_bar (e.g., "14,Mitchel", instead of "Mitchel"). A
similar fix has been done in [1]. This allows us to introduce a
test when grouped by many2one, which doesn't work as of 17.0.

[1] fd759f18d056844c486a68d0c394df5a03e789f0

closes odoo/odoo#155701

X-original-commit: 69b1809ed763d03560983bb0e4c996946dd694c5
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-02-28 18:30:16 +00:00
Romeo Fragomeli e14edcc224 [FIX] web: squashed/wrapped text in grid layout
Since Odoo v16, we also use grid in the form layout (inner group).
In a group we use the CSS `grid-template-columns` with the value of:
* `fit-content(150px)`: for the first column (TLDR: col max 150px)
* `1fr`: for the second column (TLDR: take the "remaining" max space)
```css
.o_form_view .o_inner_group {
  grid-template-columns: fit-content(150px) 1fr;
}
```
These rules at the first glance seem correct.
But due to "big word"/language, some unbreakable text is overflowing,
to avoid this, we have added the `text-break` BS class.

So now all text can be "squash"/wrap if there is no space available.

The problem is when we have a text be too long and unbreakable in the
second column, the label (first column) is squashed to see only one or
two characters.

In our case, the bug happens when we upload a file with a big filename
to an "Attachement" (`many2many_binary`) field.

On the `many2many_binary` field there is a custom CSS rules:
```css
.o_attachment .caption {
  white-space: nowrap;
}
```
that force the text to not wrap on the next line, and so the grid takes
the width of the file name as its min value for the width of the
second column, and "squash"/wrap the first column.

This commit fixes the issue by allowing the second column to be smaller
than the `max-content` width using the css `minmax(0, 1fr)`.

Steps to reproduce:
* Open "Marketing automation" app
* Create a New campaign ("New" button)
* Click on "ADD NEW ACTIVITY"
* Select the "Mail Template" field
* Create and edit a "Mail Template"
* Click on the "Options" tab
* Upload an attachment with a long name
  => BUG, all labels (first column) are "squashed"

Note:
* the `text-break` class is equivalent to:
```css
.text-break {
  word-wrap: break-word !important;
  word-break: break-word !important;
}
```
* when we use `Xfr` (X a positive numeric value `1fr` in our case)
outside a `minmax()` notation, the GRID specs[1] specifies that it
should be converted to `minmax(auto, Xfr)`.
* also the `auto`[2] in the case of `minmax(auto, Xfr)`the value
represents the largest minimum size (in our case, the file name).

[1]: https://www.w3.org/TR/css-grid-2/#valdef-grid-template-columns-flex
[2]: https://www.w3.org/TR/css-grid-2/#valdef-grid-template-columns-auto

task-3644267

closes odoo/odoo#155650

X-original-commit: dbf1794799f2be54e0a0da7719cde3e5069fcdd9
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2024-02-28 08:15:25 +00:00
Kartik Chavda (kcv) a9ebd07b80 [IMP] web: validate button is missing in pivot view
Steps:
- Open Timesheets
- Go to To Validate > All Timesheets
- Pivot View is rendered

Issue:
The validate button is not rendered when the pivot view is loaded

Solution:
The changes introduced in these files are aimed at enhancing the customization
and flexibility of the Pivot component in the web application. By adding the
buttonTemplate prop to the PivotController and utilizing it in the PivotRenderer
template, developers can dynamically choose the template for
rendering buttons within the pivot view. This change is particularly beneficial
for scenarios where different button layouts or styles are required based on
specific use cases or user preferences. Additionally, the introduction of a
default value for buttonTemplate in the PivotView configuration ensures a smooth
fallback mechanism if a custom template is not explicitly provided.
Overall, these adjustments contribute to a more adaptable and extensible
Pivot component, catering to diverse application requirements.

Task-3623493

closes odoo/odoo#155547

X-original-commit: f7fa6d66758b7ccbb0ae44e9f977177e6b29da6e
Related: odoo/enterprise#57591
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-02-27 17:40:54 +00:00
visp-odoo 974903c3d0 [IMP] web: convert condition into function
With this commit, overriding the `onWindowClick` function from `dropdown.js`
becomes much simpler. Previously, it necessitated overriding the entire function,
but now it can be done with minimal effort by just overriding this specific part.

task-3717014

closes odoo/odoo#155326

X-original-commit: edf3c7f5c566f530bed2f243a6f78fcf7d1196d2
Related: odoo/enterprise#57471
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2024-02-27 14:41:47 +00:00
Lucas Perais 4843965757 [FIX] web: kanban images background crop
On the contact kanban view, add as much tags as possible. The point is to make the right hand
part of the kanban card as tall as possible.

Before this commit, the image (on the left hand side) of the individual partner was taking all the space
in the y-axis, which was on purpose, but the cropping of the image made it so that the image
lost is sense: a face was too much cropped, or, if the image did not have sufficient pixel density, it was
pixelized.

What is specific to 17 that is barely applicable in earlier versions, is the changes in the display of many2many tags
in the kanban record: they now take more space and at a faster pace.

After this commit, we constrain that image to a maximum height and centering it.

opw-3748585
opw-3751016

closes odoo/odoo#155359

Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2024-02-27 11:21:27 +00:00
Elisabeth Dickinson 575283c3c1 [FIX] calendar, web: bring back hatched and striked styles in Year view
During the revamp (https://github.com/odoo/odoo/pull/138670) the
classes `.o_event_hatched` and `.o_event_striked` were moved.
The `o_event_hatched` works on day, week, and month
view but not in Year view of the `hr_holidays` module where the events
all look like they have the same status. The `o_event_striked`
was removed by mistake.
To fix this issue, we move the `.o_event_hatched` where it isn't under
the `.fc-event` selector (because this one doesn't exist in Year view),
and we put back `o_event_striked`.

task-3617333
part of task-3575827

closes odoo/odoo#144208

Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2024-02-26 11:41:53 +00:00
Aaron Bohy 60ac717fe2 [IMP] web: clickbot: add test for dropdown menu
This commit backports the test introduced in odoo/odoo#155154, as
it is relevant to have it in every versions to ensure that dropdown
menu (i.e. submenus) are correctly tested.

closes odoo/odoo#155218

X-original-commit: 8915c8db63d2ebc697bbfc073e3504589a26b4b8
Signed-off-by: Bastien Fafchamps (bafa) <bafa@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-02-23 18:10:36 +00:00
Benoit Socias 871b2ecaea [FIX] web, website: further neutralize BS dropdown when editing submenu
Since [1] when the mega menu were first introduced, to make their
edition possible, the bootstrap dropdown behavior was neutralized by
removing the `data-[bs-]toggle` attribute.

In [2] when Bootstrap was upgraded to version 5.1.3, the
`dataApiKeydownHandler` event handler that is called when up, down or
escape are pressed raises an error if `data-bs-toggle` cannot be found
on a previous sibling of the dropdown. This makes the approach chosen
in [1] incomplete.

This commit avoids this issue by temporarily adding a class that
is excluded from the event handler selector.
The patch must unfortunately be applied within bootstrap itself because
the event handler is registered right after the method is defined and
we have no way to access the registered event handlers afterwards.
This makes it impossible to patch the called method from outside, nor
its associated selector.

We cannot simply update the selector that was already patched by [3]
because it is also used by other methods.

A test is included which should mitigate the risk of accidentally losing
this patch upon bootstrap upgrades.

Steps to reproduce:
- Create a mega menu.
- Edit the page.
- Open the mega menu.
- Click inside the mega menu content to have a cursor selection.
- Press the arrow up key, the arrow down key or the escape key.

=> An error dialog was displayed.

The same issue happened with a nested menu instead of a mega menu.

[1]: https://github.com/odoo/odoo/commit/1345702258adbfbee0d780dc22e552395e6d1df7
[2]: https://github.com/odoo/odoo/commit/971e5a91aab96d36129a823e03f1f9f1b1293968
[3]: https://github.com/odoo/odoo/commit/daca8fe4e3da4a5ad5fabf3730496a3919af8abc

task-3614926
opw-3741670

closes odoo/odoo#155019

X-original-commit: 48f0c4203ceb5e770fed6193bd6382690b1b62fe
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2024-02-22 16:24:01 +00:00
Aaron Bohy 25cda065dc [FIX] web: StaticList: poor perfs for DELETE/UNLINK commands
Before this commit, calling _applyCommands with a lot of commands
DELETE or UNLINK on a StaticList already containing a lot of
commands was very slow. This happened for instance in the Automated
Rule form view, click on "Add an action", and in the dialog form
view, select a "mail" type, e.g. "Add followers". In that form view
there's a many2many field "available_model_ids" which contains at
first almost all models of the database (LINK commands). Switching
to a "mail" model restricts those models to the ones inheriting
from the thread mixin, i.e. it generates a lot of UNLINK commands.
On runbot, in represents 1000+ LINK and UNLINK commands. This
could take several seconds.

With this commit, we no longer iterate over all commands when
applying UPDATE, DELETE or UNLINK commands. Instead, we generate
at first a mapping of record ids to their own commands, and we
then have a quick access, given a record id, to the list of his
commands, which is small in comparison to the whole list of
commands. After iterating over all commands, we generate the new
list of commands and we update this.records and this._currentIds
to do the necessary cleanups (i.e. removing records and ids for
which we received DELETE/UNLINK commands).

task 3599674

closes odoo/odoo#154568

Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2024-02-21 12:59:06 +00:00
Khushi 097c7bc91d [FIX] documents: handle multiple clicks on record in selectCreateDialog
Steps to reproduce:
- Go to Documents activity view.
- Click on Schedule activity.
- Perform multiple clicks on any record.

Issue:
The 'Schedule Activity' wizard opened as many times as the record was clicked.
As a result, even after successfully scheduling an activity on that record,
the user still faced multiple open wizards remaining and had to manually close
each one of them.

Fix:
This commit introduces a method `executeOnceAndClose` which makes use of a
flag 'busy' to ensure that the `onSelected` function is called only once and
hence exactly one `Schedule Activity` wizard is opened, despite clicking a record
more than once.

closes odoo/odoo#154442

Task: 3721404
X-original-commit: 19cc5ea3cf2c8fcf742ba5ab9b4b82305d81d555
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-02-20 07:52:05 +00:00
Julien Carion (juca) 8873795799 [FIX] web: autocomplete may prevent change event
This commit fixes a pretty specific issue within autocomplete behavior
where the change event after clearing the value is prevented.
Steps to reproduce:
- go to an empty autocomplete and click on it
- start typing a search with results
- click on the first result
- without focusing out, clear the input and finally click out

No change event is triggered on click out in this case so the cleared
value is not updated in the end and saving the record will keep the
non cleared value.
The t-on-mousedown.prevent in the dropdown was mainly used to keep the
focus on the input after selecting a value for the autocomplete. This
introduces a side effect: when one starts typing on the initially empty
autocomplete, the browser keeps the initial value of the input in memory
until it is focused out (and therefore blurred). When the input is
focused out, it will compare the current value of the input with the
stored initial value and decide to trigger a change event based on the
comparison between the two values: if these are different, the change
will trigger. In our case, since the mousedown event on a search result
is prevented, no focus out will happen and therefore the browser will
still wait for the next focus out to trigger the eventual change event.
But since we clear the input before focusing out, the two values are
empty and no change event is triggered which introduces the issue.
To fix it, we remove the t-on-mousedown.prevent of the template and
manually avoid triggering the onInputBlur method with a flag to keep
the previous behavior and we finally focus on the input programatically
after selecting a value.

task-3734818

closes odoo/odoo#154448

X-original-commit: 9d3d5d937e37ab6ef0c393e11cfb449f2897f6c1
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Julien Carion (juca) <juca@odoo.com>
2024-02-19 16:29:15 +00:00
Aaron Bohy ad299c9325 [FIX] web: no error when reading cssRules
This commit follows [1], which attempted to fix CORS errors
occurring when we access the `cssRules` property of stylesheets,
to detect scss compilation errors and display a warning to the
user.

[1] doesn't seem to be enough, as we faced another source of CORS
errors. Indeed, in non-secure http, the error is raised even if the
origin is the same.

We never want this access to crash anyway, as it's a nice to have
feature, and if reading `cssRules` is forbidden, there's nothing
the user can do anyway. For those reasons, we decided to simply
protect the code with a try/catch.

[1] odoo/odoo#152696

opw 3746910

closes odoo/odoo#154347

Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2024-02-16 12:12:49 +00:00
Thomas Lefebvre (thle) 38331cbaaa [FIX] web: do not reopen new dialog
Issue:
------
On the calendar application, it is not possible to create a 15-minute event
directly from a selection using the mouse.

An event with a default duration of one hour is created.

Cause:
------
The fullcalendar library detects two events:
- a date selection
- a click

The date selection is correct, but the size of the "rectange" is the same
(15 minutes is the smallest unit in terms of size).
As a result, a click using a default time is detected.

Solution:
---------
We can use `preventDefault` to block the second event (the click)
because the event is the same.

Note:
-----
This fix is safer than patching the `FullCalendar` library
(which may change in future versions).

opw-3743945

closes odoo/odoo#154135

Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2024-02-16 08:58:19 +00:00
Antoine (anso) d7371fc32c [FIX] web, website: restore background to notifications in front-end
Before this commit, `.bg-view` was set to `.o_notification`. This was
creating an issue in the front-end where `.bg-view` doesn't exist,
making the background of the notification transparent and ultimately
causing readability issues. Issue introduced in [1].

This commit changes the way we apply the background from a utility
class approach to a SCSS approach. That way, we can easily override
in `website.scss` with the `$body-color` of the website.

task-3716367
[1] 4e1f0b8ea522accae4860937c2fb3815281e8483

closes odoo/odoo#154081

X-original-commit: f8f8d2905db633cfaaa93b6cd163f4ab55dc4c8f
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2024-02-16 08:58:16 +00:00
Youssef Bashandy 3e4b005f30 [FIX] web : allow setting iso format date as default
Steps to reproduce:
	1- Install Sales module
	2- Activate developer mode
	3- Navigate to any storable product
	4- Click on 'Replenish'
	5- Click on 'developer bug' and Choose 'Set Defaults'
	6- Choose 'Scheduled Date' from the 'Default' dropdown menu and Save

Current behavior before PR:
When trying to set a default value for scheduled date in 'Replenish' for a product it will display an error for 'Invalid type' this is happening because when converting the string value to a datetime value it does not handle iso format date and this is the format that gets passed from the UI.

Desired behavior after PR is merged:
It is handled now from the UI side that the format that is been sent is the server valid format of datetime.

opw-3692472

closes odoo/odoo#154209

X-original-commit: 6dc46639935fdc175b2d094b58ef4e66c68466b0
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
Signed-off-by: Youssef Bashandy (yoba) <yoba@odoo.com>
2024-02-15 18:21:34 +00:00
Hubert Van De Walle d8ca1f3412 [FIX] web: missing measures in graph view
Steps to reproduce
==================

- Install account_accountant
- Go to settings
- Enable Budget Management
- Go to Accounting > Reporting > Management > Budgets Analysis
- Switch to the graph view
- Change the measure to "Planned amount" and then back to
  "Practical amount"

=> The practical_amount measure is undefined,
   The theoritical_amount measure is missing.

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

The view is defined as follows:

```xml
<graph string="Budget Lines" sample="1">
    <field name="crossovered_budget_id" type="row"/>
    <field name="planned_amount"  type="measure" string="Planned amount"/>
    <field name="theoritical_amount"  type="measure" string="Theoretical amount"/>
    <field name="practical_amount" type="measure" string="Practical amount"/>
</graph>
```

The theoritical_amount and practical_amount are non stored fields and
thus are skipped inside `computeReportMeasures` unless they are passed
in `activeMeasures | additionalMeasures`. [0]

When parsing the graph view, the last field of type measure is
passed to the graph model and is the one that will be used initially. [1]

This is why the practical_amount is initially defined.

Solution
========

We simply need to keep track of fields of type measure.
This was the case in 14.0 but got lost in the conversion.

---

[0]: https://github.com/odoo/odoo/blob/e7a9ebec3176c37485643fcda2381e489a1df86f/addons/web/static/src/views/helpers/utils.js#L49-L60
[1]: https://github.com/odoo/odoo/blob/0fb64bef16914937cf4a1d1618fb58ade6d16f14/addons/web/static/src/views/graph/graph_arch_parser.js#L63

opw-3713613

closes odoo/odoo#153967

X-original-commit: 76178cd61ba10ff29b24183edb550c54b319a230
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2024-02-14 17:17:00 +00:00
Benjamin Vrayandqsm-odoo 1414d34727 [FIX] web, website_sale: fix products page with a dark body background
Steps to reproduce the bugs:
- Install the e-commerce on your website.
- Go to the "/shop" page.
- Click on "Edit" to enter edit mode.
- Click on the "Customize" tab.
- Choose "Cards" for the "Style" option.
- Enable the "Product Description" toggle.
- Click on the "Theme" tab.
- Click on the 4th color of the theme colors and choose "black".
- Save the page to exit edit mode.
- Bug 1: The product description and the price in the product cards are
not visible.
- Bug 2: The scrollbar below the category buttons has the same color as
its background.
- Click on the "Mobile Preview" button in the backend navbar.
- Click on the "Filters" button on the page to show the offcanvas.
- Bug 3: The text color in the offcanvas is not visible and the
background color of the inputs is the "body" background color instead of
the "offcanvas" background color.

opw-3570774

closes odoo/odoo#153930

X-original-commit: add2b9273e90e3940ee52eee4ff42afa46c18a20
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2024-02-14 11:20:44 +00:00
Benjamin Vray 46a7979cc2 [FIX] web, *: fix text color of popover and badge if dark background
*: website_sale

Steps to reproduce the first bug (popover):
- Install the e-commerce on your website.
- Go to the "Customizable Desk" product page.
- Click on "Edit" to go in edit mode.
- Click on the "Theme" tab.
- Click on the 4th color of the theme colors and choose "black".
- Save the page to leave edit mode.
- Click on the "Add to cart" button.
- Hover over the cart in the navbar to make the popover appear.
- Bug: All the popover texts are not visible because they are white and
the background is white.

Steps to reproduce the second bug (extra price badge):
- Install the e-commerce on your website.
- Go to the "Customizable Desk" product page.
- Click on "Edit" to go in edit mode.
- Click on the "Theme" tab.
- Click on the 4th color of the theme colors and choose "black".
- Save the page to leave edit mode.
- Bug: The text of the "extra price" badge is not visible because both
text and background are white.

These two issues existed because the text color of those elements
depended on the body's background color. With this commit, the text
color for those elements is now determined by their respective
backgrounds.

This commit is a follow-up to this commit [1]. We also add the handling
of the text-muted color to ensure it remains visible if a modal has a
dark background while the body background color is light. Before this
commit, we only handled the opposite case (dark body and light modal).

This commit also fixes the text color of the button in a file input of a
form when the background color of the <body> is dark. Similar to the
other elements fixed in this commit, the text color of this button could
be invisible because it was the same color as its background.

[1]: https://github.com/odoo/odoo/commit/308b91c58b00300fd8dc52b9b4e2f7d1ab31f7b7

opw-3570774

X-original-commit: 0c2806576e85106d06f4275c9204e664f69793d8
Part-of: odoo/odoo#153930
2024-02-14 11:20:44 +00:00
abd-msyukyu-odoo ddba01a8d4 [FIX] web: conserve empty opt. columns headers for list view
The string value of an empty array is `""` which is falsy. Prior to this commit,
if all optional columns headers were disabled in a list view, it would result in
a reset of those when the view is mounted the next time, instead of keeping them
disabled like in prior versions.

task-3692178

closes odoo/odoo#153831

X-original-commit: e600ed2fa2f2e612dfca20872356ae926dde0a54
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Damien Abeloos (abd) <abd@odoo.com>
2024-02-13 20:52:16 +00:00
Levi Siuzdak (sile) 02ea85a12f [FIX] web, hr_holidays: homogenize week numbering
Versions
--------
- 17.0
- 17.1
- master

Steps
-----
1. Go to Settings / Manage Languages;
2. select your current language;
3. set First Day of Week to something other than Sunday;
4. go to Time Off app.

Issue
-----
Weeks in year overview still start on a Sunday.

Cause
-----
Commit 52dae7a2f0 hardcoded `firstDay` to
Sunday for the `hr_holidays` module. This was a workaround to some
issues with `fullcalendar`'s week number calculations.

Solution
--------
Remove the hardcoded `firstDay`, and add a custom week numbering
function to be used on week, month, and year calendar views for
consistent numbering that allows for different first days of the week.

The function returns the ISO week number of the Monday nearest to the
configured first day of the week, i.e. the following Monday when first
day is set to Friday, Saturday or Sunday, the previous Monday if first
day is set to Tuesday, Wednesday or Thursday.

There were 3 main considerations for deciding a week numbering method:
1. no exisiting setting for users to decide on a method;
2. the ability to pick a first day of the week independent of locale;
3. the version of `luxon` used being unable to factor in locale.

Addendum
--------
This commit doesn't fix the issue with group-by week numbering in list
view. These stem from `babel`'s inconsistent locale defaults and
inability to take user-configured first day of the week into account.

opw-3668175

closes odoo/odoo#148623

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2024-02-13 12:21:50 +00:00
Aaron Bohy 22f897275d [FIX] project,web: improve perf of project task list view
Before this commit, to render the table, the project task list
view computed the list of selected records once for each cell,
and then iterated over that selection to check whether selected
tasks were all associated with the same project (to set the
stage_id field readonly if not). However, computing the selection
requires to iterate over all records, so the rendering was O(n^2).
As a consequence, the rendering of (not so) large tables was very
slow (~1s for 80 records).

With this commit, we compute only once for the whole table whether
the selection contains records from different projects.

closes odoo/odoo#153611

Signed-off-by: Géry Debongnie <ged@odoo.com>
2024-02-13 10:07:57 +00:00
damr bf6193fac9 [FIX] web: fix deleted personnal stage reappear after deletion
This commit's purpose is to fix the re apparition of personnal stage on
the todo app when personnal stages are deleted one after the other.

Step to reproduce:
-login as Marc demo
-open todo
-delete any personnal stage without any todo in it
-delete any personnal stage with at least one todo in it

The personnal stage deleted first is now present again in the kanban
view. Note that it is only a frontend bug. The record has been correctly
removed from the db, and any action with it will trigger a cache miss
exception and reloading the view completly will removed those ghost
stages definitly.

Source of the problem:
The problem is that the deletion is only reloading the view completly
when a record with child data is removed. More precisly, the
_deleteGroup function of the dynamic list triggers an rpc call to update
the config of the component only when a record with child data is
deleted, and that data need to be switched to another record, while when
it is an empty record, the record is simply removed from the group
field of the list. The issue is that there is thus a mismatch between
the group in the list.config.groups and the list.group. And when the
config is updated, only the list.config.groups is used to update the
config, meaning it potentially still contains element that were already
deleted.

Solution:
Doing a check up on the list.group to ensure that any deleted element is
also removed from the config when an update is triggered.
Note: I dont why Mitchel admin did not trigger the bug. Code wise, it
should happends no matter the access right of the connectedd user.

Version affected:
17.0+

task - 3553101
https://www.odoo.com/web#id=3553101&menu_id=4720&cids=1&action=333&active_id=4105&model=project.task&view_type=form

closes odoo/odoo#142536

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-02-13 10:07:50 +00:00
Samuel Degueldre bc2a3bc55c [FIX] web: stop views leaking their models
Previously, when exporting its state so that it could be restored later,
the relational model would export its config. The problem is that
because this config is a reactive object, it keeps a reference to the
components that may need to be notified by that reactive object. This
exported config was then stored on the next controller, which would be
retained by the next config, etc.

This commit fixes that by exporting a raw version of the config.

Part-of: odoo/odoo#153654
2024-02-12 22:26:16 +00:00
tsm-odoo 7d18bf0f83 [FIX] im_livechat, mail: broken history navigation
This PR fixes 2 issues with discuss navigation:

1. Broken backwards navigation when going back and forth from the live
chat session history.
2. Broken backwards navigation when trying to access the same thread
than the current one.

Steps to reproduce 1:
- Open the command palette
- Go to the live chat session history view
- Click on one of your channels
- History back => leads to the session history view
- History forward => leads to discuss
- History back => stays on discuss, history is broken

This occurs because the active id is not passed in the action context
when navigating backwards which leads to the URL being pushed again in
history (URL without active id is different). The active id should be
put in the context when available.

Steps to reproduce 2:
- Go to discuss
- Click on the active thread
- History back => stuck on discuss, cannot navigate backwards anymore.

We should not push in history when accessing the same thread than the
current one.

task-3422516

closes odoo/odoo#153094

X-original-commit: 029b79ad7dc28aab83289e7c3ebd4cc0dcc5d609
Signed-off-by: Matthieu Stockbauer (tsm) <tsm@odoo.com>
2024-02-12 20:24:07 +00:00
sami odoo cb613bc606 [FIX] web: kanban: can apply progressbar filters on newly created groups
Before this commit:
When the user creates new stages or groups in Kanban view and adds new tasks
with particular states and then if the user clicks on any colour in the
progressbar then the filter gets applied on all the groups or stages.

Observerd Behaviour:
The filter is applied on all the groups or stages.So, if we click on a colour
in the progressbar suppose colour Green to filter out Approved task(s) of a
particular stage then in that stage or group only the Approved task(s) would be
visible. Also the filter would get applied on all other stages or groups created
at that time. In those stages all the task with that state would be visible and
rest of them would get blurred.

Steps to produce:
- Install `Project` and add a new project in it.
- In the newly created project add some new stages or groups, each consisting
  some new tasks.
- Give some states to those tasks through project state selector
  (for eg: Approved, Changes Requested).
- Click on any particular colour in the `Progressbar` of any particular group or
  stage.

Expected Behaviour:
When the user clicks on any colour in the progressbar then it should filter out
only those tasks which are associated with that color/state and only in that
particular group or stage.

Reason:
https://github.com/odoo/odoo/blob/579ee6d9792050955fa80346fd57ad294efcdd62/addons/web/static/src/views/kanban/progress_bar_hook.js#L114
group.serverValue results as Undefined. Because when the data is being prepared
here:
https://github.com/odoo/odoo/blob/493d5c39982de79e6fb256dd8084bf592a740f77/addons/web/static/src/model/relational_model/dynamic_group_list.js#L222-L231C11
there is no serverValue provided. So, whenever a group is getting created
here serverValue `Undefined` as value.
https://github.com/odoo/odoo/blob/493d5c39982de79e6fb256dd8084bf592a740f77/addons/web/static/src/model/relational_model/group.js#L25

Note:
- There was a need to change the function name from
`getServerValueFromGroupData` to getGroupServerValue as now now this function
calculates serverValue while the data is being created and not when the data is
already created.
- The function is exported into another file as this function defines the basis
to calculate serverValue and there is a necessity to calculate serverValue while
data is being created.

Task-3620697

closes odoo/odoo#149694

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-02-12 12:31:08 +00:00
Samuel Degueldre 857c540f6a [FIX] web: prevent luxon objects from being made reactive
When reading values in reactive objects, Owl's reactivity system will
return reactive versions of the sub-objects to allow tracking reads in
depth, so that changes to values in deep object hierarchies can still
cause components to render themselves if needed.

Luxon objects are immutable. Since they cannot change and values inside
them cannot change either, tracking reads within luxon objects is pure
overhead.

This commit makes luxon objects non reactifiable by setting the
Symbol.toStringTag property on the luxon classes, which is what Owl uses
internally to determine if objects can be made reactive. It will also
cause some of these objects to serialize to more specific strings
instead of just [object Object], eg [object LuxonZone].

closes odoo/odoo#153540

X-original-commit: ac58cb22cd8b275f89bf387a6cea8144ce26ee65
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2024-02-12 10:44:48 +00:00
Aaron Bohy 578b94ec26 [FIX] web: list: reset offset of groups when reloading
Have a grouped list view s.t. there's a group with enough records
to have a pager in the group. Go to the second page of that group.
Then, apply a filter such that there's only a single page remaining
in the group. Before this commit, no record was displayed, because
the previous offset wasn't reset to 0 it should have been. With
this commit, the offset is recursively reset, so we correctly
display the records of the first page after a reload.

closes odoo/odoo#153494

Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2024-02-12 10:44:44 +00:00
tsm-odoo b93ba8f631 [FIX] website_livechat: fix non deterministic reaction tour
Before this PR, the `test_complete_chatbot_flow_ui` would sometimes fail
when checking if the user can add a reaction to a message.

There are two issues:
- This step uses the `contains` helper and specify the live chat `ShadowRoot`
as the target. However, the `contains` helper uses a mutation observer
that observes the light DOM thus, changes in the shadow root are not
correctly observed.
- The target passed to the `contains` helper is the `ChatWindow` DOM
element but this element can be unmounted in-between.

This PR fixes this issue.

fixes runbot-56670

closes odoo/odoo#153382

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2024-02-09 11:57:34 +00:00
Julien (jula) a00aff8b95 [FIX] web: fix crash in cssFind if too many elements
__Current behavior before commit:__
The `find` jQuery method calls at some point `apply` on the results.
Sometimes however the number of results can exceed the maximum number of
arguments given to a function.

In such case `RangeError: Maximum call stack size exceeded` is thrown.

__Description of the fix:__
Instead of selecting all children with `find('*')` and filter them
afterwards with the selector, we find all the elements that match the
selector in the closest `<body>` parent and then we keep only those
contained inside `$from`.

opw-3703963

closes odoo/odoo#153161

X-original-commit: 2667c8d42c5ac18257975e166a2aea254416e3fa
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Julien Launois (jula) <jula@odoo.com>
2024-02-08 12:29:22 +00:00
luvi f8a53d3a11 [FIX] web: SelectMenu: fix onInput props usage
This commit fixes an issue caused by the way we use onInput props in Knowledge to
fetch articles depending the current search value. Since we start from an empty
string in the input again, it make no sense to display the choices previously
fetched with a search value no longer displayed in the UI. The only way to display
the correct items is to update the input value, then put an empty search to fetch
accordingly.

This is clearly an issue, when the onInput props is used to fetch the content of
the SelectMenu, depending of the search value. The UI obviously display an empty
search, and filter accordingly, but without fetching the items corresponding to
the empty search value.

A test was added as well to assert SelectMenu can be used for this purpose without
forgetting to call onInput again when clearing the search value in beforeOpen.

closes odoo/odoo#153072

X-original-commit: ca417f171b1bd2dd567beed7bc0e1fcaba6c8a4c
Signed-off-by: Bastien Fafchamps (bafa) <bafa@odoo.com>
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2024-02-07 18:34:22 +00:00
luvi 1365dad144 [FIX] web: fix SelectMenu style with o_select_menu_sticky class
This commit fixes the style applied to the o_select_menu_sticky elements. Since the
fix from commit (1), the text cursor is shown when hovering those elements. This was
without considering the fact that this class is mainly used to display elements on
top of other elements of the component.

This includes usages with the bottomArea slot, that can be used with a DropdownItem.
Because of the changes from the commit previously named, the focused color was no longer
applied, and it was showing the wrong cursor when hovering.

1) 53466e152bb819524b2890866bea4cbdd9091275

X-original-commit: 8ecc6f2a960494f01a745f21a24c3cc57614ad86
Part-of: odoo/odoo#153072
2024-02-07 18:34:22 +00:00
Aaron Bohy d1e14994a9 [FIX] *: use correct float formatter
Commit [1] moved (almost all of) the code of formatFloat from
views/fields/formatters.js to core/utils/numbers, to make it
accessible in the frontend. A formatFloat function was kept in
formatters.js to handle the false case, which makes no sense in
number utils, but is useful for fields. However, a lot of imports
have been updated to use the numbers.js instead of formatters.js
(i.e. they no longer benefit from the support of false), whereas
they are actually formatting field values, so they should have
kept using the formatFloat from formatters.js

This commit adapts the places where the formatFloat to use must
come from formatters.js, not numbers.js.

[1] https://github.com/odoo/odoo/commit/054ca0a19aaf297f420a1b478b93ae26f1b943b8

task 3722043

closes odoo/odoo#152810

Related: odoo/enterprise#55919
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2024-02-06 20:16:20 +00:00
Julien Carion (juca) a813104ef4 [FIX] web: don't remove sample data on view switch
This commit solves an issue where sample data would be erased when the
user switches from a view with no sample data to another that should
contain them. This commit also removes unnecessary usage of nextTick in
assets loading.

Steps to reproduce:
- go to project and open one
- enter a no match filter and save it as favorite
- reload
- switch from kanban to calendar view and switch back to kanban
- after the fix, sample data should no longer be erased from kanban

task-3701143

closes odoo/odoo#152666

X-original-commit: a8ff1465c6c31240d06c98fa5d61e146b3908cf0
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Carion (juca) <juca@odoo.com>
2024-02-05 23:51:15 +00:00
Paul Stroobant ea27398c4b [FIX] web: reload many2xautocomplete component on props update
Steps to reproduce the issue:

1. Open Menu Items
2. Open the form to a menu
3. Select an action type (e.g. ir.actions.report)
4. Select another action type (e.g. ir.actions.act_url)
5. Click on the field next to it
6. Click on "View all"
7. The results displayed match the first action type selected (report), not the second (act_url)

Explanation:

`res_model` is initiated in two functions: `useOpenMany2XRecord()` and `useSelectCreate()` in the `setup()` of the `Many2XAutocomplete` class. The value is never updated for as long as this instance of the field exists.

Suggested fix:

Everytime the key changes, a new instance of the field will replace the current one, calling its own `setup()` with the updated values.

opw-3628017

closes odoo/odoo#151495

X-original-commit: d4078d783717986189f9fbc1b6dd6b264e41e49e
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
Signed-off-by: Stroobant Paul (stpa) <stpa@odoo.com>
2024-02-05 18:24:39 +00:00
Aaron Bohy ee9b5ee131 [FIX] web: no CORS error with css assets served via CDN
Before this commit, we tried to access in javascript the cssRules
property of some stylesheets, to parse and display to the user
potential css errors, to help him to detect and fix them. [1]

Since a recent change [2], people get tracebacks on website pages
in odoo.com (without being logged in).

The issue comes from the fact that when assets are served via a
CDN (which is the case in odoo.com for not logged users), reading
the cssRules throws a CORS error. This error is logged in the
browser console.

We only spotted the issue since [2], because it delays the moment
we access the cssRules property (we wait for translations). Thanks
to that, the error service is ready and able to handle errors, and
it does display the error in a dialog, which allowed us to detect
the issue.

To fix the issue, we filter out stylesheets with a different
origin.

[1] 5e920db3ee
[2] 332268c724

closes odoo/odoo#152696

Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2024-02-05 16:32:54 +00:00
Hubert Van De Walle 939395aefe [FIX] web: tooltip service should not cleanup when mouse is inside
Steps to reproduce
==================

- Use a laptop with touch or apply the following patch

```diff
diff --git a/addons/web/static/src/core/browser/feature_detection.js b/addons/web/static/src/core/browser/feature_detection.js
index 21c6294b1b0e..64c4bc9b899c 100644
--- a/addons/web/static/src/core/browser/feature_detection.js
+++ b/addons/web/static/src/core/browser/feature_detection.js
@@ -62,6 +62,7 @@ export function isDisplayStandalone() {
 }

 export function hasTouch() {
+    return true;
     return browser.ontouchstart !== undefined || browser.matchMedia("(pointer:coarse)").matches;
 }

```

- Enable debug mode
- Go to contacts
- Hover the mouse over a question mark next to a field

=> Nothing happens

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

The function `shouldCleanup` returns true when the device has touch and
the popover has been triggerd with the mouse

opw-3694156

closes odoo/odoo#152629

X-original-commit: 27242a0f1070b6b16c16e479e22dc0ccad0d9659
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2024-02-04 14:39:24 +00:00
Aaron Bohy b2406f72ad [FIX] web: statusbar field: load status with correct domain
Before this commit, there was a race condition with the statusbar
field, and more specifically with useRecordObserver.

The issue could be reproduced in the form view of project.task. In
an existing task, belonging to a project with some stages, change
the project to another project with its own stages. It might happen
that the displayed stages weren't the ones of the newly set project.
If this didn't happen directly, this happened upon saving (i.e. the
correct stages are displayed just after switching the project, but
as soon as the user saves the record, the former stages are back).

This happens because useRecordObserver used an outdated version
of the props to get the domain (i.e. the props of the component
have been updated, but useRecordObserver still used the old version,
in particular the old props.domain).

This commit fixes the issue by ensuring that we always use the last
version of the props.

opw 3693113

closes odoo/odoo#152433

Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2024-02-02 19:49:45 +00:00
Brieuc-brd 6b3e0d8c84 [FIX] web: dropdown caret position
Commit[1] introduced necessary change to resolve a layout issues on the
caret icon in the Search Bar menus. But at the same time, it introduced
a layout issue on dropdowns in the Pivot view: carets were no longer
placed on the right.

But since commit[2], the Search Bar menus have become accordions instead
of dropdown menus. The change made in commit[1] is therefore no longer
necessary. We can now remove it to fix dropdown menus in the Pivot view.

task-3718186

[1]: https://github.com/odoo/odoo/commit/6375ca94cdfe27fc617565ef6bba4826d112e740
[2]: https://github.com/odoo/odoo/commit/976491e01272336bc34abcdcec2718f83e19c5fc

closes odoo/odoo#152417

Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2024-02-02 19:49:42 +00:00
Aaron Bohy 82fd8e7025 [FIX] web: make urgentSave more robust
In form views, when the user closes the tab while having unsaved
changes, and if those changes are valid, we want to save them
automatically before leaving.

Before this commit, there could be situations where the changes
weren't actually saved. For instance, if they involved an heavy
payload for the write rpc, or if the network connection was poor,
it might happen that the xhr is killed. Or at least, browsers do
not offer any guarantee to wait for those xhr to reach the server.

Instead of a classical xhr, we thus use navigator.sendBeacon which
ensures that the data will be sent reliably [1]. There's a drawback
though, as its payload is limited. When the payload is too heavy,
sendBeacon simply returns false and does nothing. In this case,
we prevent the page from unloading and display a notification
suggesting the user to manually save his changes before leaving.

[1] https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon

Task 3537838

closes odoo/odoo#151834

X-original-commit: 0b53daa60ee5b370def21c8e0e30a6819597a0e4
Related: odoo/enterprise#55457
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2024-02-02 09:18:42 +00:00
Luis González c183585c80 [FIX] web: add missing ARIA attributes to command palette
Since searches in the home screen are now handled by the command palette,
some ARIA attributes are required for assistive technologies to know
what is the currently-selected result. That because the actual focus is
always on the search box, while the actually-selected result is
highlighted by toggling classes, which makes not possible anymore to
know what is the selected result for e.g. screen reader users.

For more info, see original implementation on enterprise's home menu on
[1]. This commit is just re-applying such changes here.

[1] odoo/enterprise#14511

closes odoo/odoo#152147

X-original-commit: 9764e6f7fe39a10f3b04e1764110d8c274d0431a
Related: odoo/enterprise#55562
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2024-02-01 08:24:13 +00:00
Shaan Thakkar (THSH) ba3980e132 [FIX] web: resolve traceback when switching to mobile view
Steps to reproduce:
===================
1. Configuration > Projects
2. Open any project
3. Setting tab
4. Document field
5. Create and edit a new workspace.
6. Inspect mobile view
7. Save it or discard it -> traceback occurs

Technical Reason
================
The dialog values are prepared based on the desktop view, which results in the
scrollToOrigin function is not being prepared when the condition is not met.
Consequently, when the view is switched to mobile and inside the onWillDestroy,
the scrollToOrigin is called but it is not prepared so traceback occurs.

After this commit
=================
Now the function will be prepared even if we are not in the mobile view and
traceback will not occur.

Task-3573747

closes odoo/odoo#152074

X-original-commit: bc0a313f56347ea74eea1e5106cef8d86357c9ef
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-02-01 07:06:56 +00:00
FrancoisGe 9891156c3b [FIX] web: CP keep the correct searchValue
Before this commit, in the command palette, during a search, it is possible
that the value entered is modified. The problem only occurs if the namespace
has a debounceDelay bigger than 0 and at least one of its command providers is async.

How to reproduce:
=================
- Go to the command palette with the @ namespace.
- Type a few characters
- Re-enter a few characters
If you repeat this operation several times, some characters may disappear.

Why:
====
The value of the input is modified at each "input" event, but the searchValue
in the state is only modified when the debounce trigger "search".
Since the command palette template is contained in a slot, each state
change causes a complete rendering of the command palette. When the search is executed,
the commands are added to the state after each provider has generated them,
so a rendering takes place and it is the value contained in state.searchValue
that is used for the input and not the value contained in it before the rendering.

Solution:
=========
No longer modify state.searchValue during the search, but at each input event.

closes odoo/odoo#151906

X-original-commit: f4e1350e3a03c8a3a2b6bab8f4f74e278b1d2905
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-31 17:13:52 +00:00
Benjamin Vray ab0e0f4bef [FIX] web, website_sale: fix text color of modals if dark body background
Before this commit, if the text color of the body was light (e.g., due
to a dark body background), the text in certain modals (for example, in
the "Alternative products" modal displayed when adding a product to a
cart on a product page) was also light, making it not visible on the
white modal background.

Steps to reproduce the bug:
- Install the e-commerce on your website.
- Go to the "Customizable Desk" product page.
- Click on "Edit" to go in edit mode.
- Click on the "Theme" tab.
- Click on the 4th color of the theme colors and choose "black".
- Save the page to leave edit mode.
- Click on the "Add to cart" button.
- Bug: The text in the the modal is not visible because both text and
background are white and the input elements have their background the
same color as the body.

After this commit, we now verify that there is sufficient contrast
between the text color of the body and the background color of the
modals. If this condition is not met, we apply an alternative color
("$color-contrast-dark" or "$color-contrast-light") to the text of the
modal to ensure visibility.

opw-3570774

closes odoo/odoo#151346

X-original-commit: ffd2f2363f20b88ec05c153c57057b538c3885d2
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2024-01-31 13:47:11 +00:00
Abdelouahab (abla) af66512ea8 [FIX] web: open record from list with a x2m field on virtual record
To reproduce
============
- On a project, on a task
- create a subtask give it a name and from the list view click on the
  "view" button
- you get redirected to form view to create a new task that is not related
to the parent task or the project

Problem
=======
When you click on the "view" button, the task is not saved yet, so the
subtask doesn't exist yet to be viewed in Form view

Solution
========
We prevent the redirection to the form view if the record is not saved yet
same logic as : https://github.com/odoo/odoo/commit/9b136383c2599301413e6770cc0ff204273b589d

opw-3681471

closes odoo/odoo#149753

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-31 13:47:07 +00:00
Aaron Bohy 332268c724 [FIX] web,test_assetsbundle: correctly display scss error
Before this commit, when there was an error while compiling scss,
information was added in the compiled css bundle s.t. the client
is aware there was an issue and can indicate it to the end user.

In particular, a dialog was shown with a static message, and
with what should have been the python stack trace. However, the
stack trace was missing.

In addition, a banner should have been displayed in the bottom left
corner the screen, telling that a former version of the bundle was
used as the new one is in error. This banner wasn't displayed
either.

Finaly, forwarporting odoo/odoo#149230 automatically closed the
dialog, as we close all dialogs when executing an action (in this
case the first action when the webclient starts). As a consequence,
the dialog was no longer displayed either.

To sum things up, before this commit, 1) there's no longer a dialog,
even if there were, 2) the dialog doesn't contain the stack trace,
and 3) there's no banner.

To fix 1), we simply display a notification instead. Opening a
dialog for this simply doesn't fit with odoo/odoo#149230, and a
sticky, danger, notification is totally fine for this.
A notification being smaller than a dialog, it says to open the
console to see the stack trace instead of inlining it.

2) has been inadvertendly introduced by [1]: quotes in the error
were doubly escaped (\\"), meaning that they weren't escaped at
all, so the js couldn't properly read the value

And the source of error for 3) was that the last line of the css
bundle (the sourcemap comment line) wasn't valid. It started with
`//*`. As a consequence, the remaining of the file wasn't processed,
and that's exactly where the assets bundle error handling code
inserted the error information.

[1] 64bbef5bc1

closes odoo/odoo#149543

Related: odoo/enterprise#55257
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2024-01-31 01:31:53 +00:00
FrancoisGeandAaron Bohy 8665bf83dd [FIX] web: close dialogs when executing action
Have a form view in a dialog with an action button (e.g. a stat
button). Click on it. Before this commit, the action was executed
in the background, but the dialog remained open, which could
confuse the user and was definitely weird UX-wise.

With this commit, we automatically close all dialogs when we
execute an action which will update the main action container.

Note that this was working in previous versions thanks to legacy
compatibility code [1], but this code has no impact on the new
(wowl) dialogs, so as of 16.0, it has very limited impact.

Here's a specific scenario to reproduce the issue:
- go to the project task gantt view
- click on a pill
- in the task for view (in dialog), click on the external button of
  the project many2one
- in the project form view (in dialog), click on a stat button (e.g.
  "At risk")
-> before this commit, the 2 dialogs remained open.

opw 3644904

[1] https://github.com/odoo/odoo/blob/15.0/addons/web/static/src/legacy/action_adapters.js#L42

X-original-commit: 03fa39738c4f81ae30caaaa032c099797ecba9e7
Part-of: odoo/odoo#149543
Co-authored-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-31 01:31:53 +00:00
Julien Segers (juse)andLuca Vitali 7af78e6aa5 [PERF] web: avoid unnecessary sorting in select menus
Sorting is being computed on each mounted select menu during the useEffect() hook since this commit: 8a44857.
This can lead to long wait times or browser crashes when there are many select menus with many options.

Before this commit, all of the select menu were sorted when the user select a value in one of them.
This is not necessary as the sorting is already handled in beforeOpen.

After this commit, no sorting is being computed in useEffect() anymore to avoid unnecessary computation.

A test has been added to verify the sorting happens when needed.

opw-3616438

closes odoo/odoo#151318

X-original-commit: f58b88383ce6a7439c02dbe761dc9025ddfe3b0a
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
Co-authored-by: Luca Vitali (luvi) <luvi@odoo.com>
2024-01-26 21:08:02 +00:00
Simon Genin (ges) bf65cb53d0 [FIX] web: datetime range with always range when empty and readonly
Recently, a new option 'always_range' has been added to the datetime
field (task 3628069, commit bc98aad). This option forces the display
of the arrow between the two dates from the start. Before that, you
would add a first date, click a button to add a second date and then
only would the arrow appear.

The oversight here is when the field is empty AND readonly. In that
case, you have an visible arrow next to the label but you can't do
anything with the field anyway. So better not to show it.

This commit makes sure to not display the arrow in this case.

task 3690523

closes odoo/odoo#149912

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-26 21:07:53 +00:00
Julien Carion (juca) 01aa0621b9 [FIX] web: avoid popover crash in iframe
This commit solves a crash which can happen when a popover points to an
element inside an iframe that has been removed from the DOM. In those
cases, the element's ownerDocument does not have a defaultView.

closes odoo/odoo#151235

X-original-commit: 1ccebdbd2fcc6875173b02a31d89f3c2e9ffbfec
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2024-01-26 09:13:07 +00:00