Commit Graph
18393 Commits
Author SHA1 Message Date
Hubert Van De Walle c6640ddafd [FIX] web: keep group order when restoring empty kanban group
Steps to reproduce
==================

- Go to Field Service
- Group by "start date: week"
- Archive every record in a column until there is only one left
- Go back to the kanban view
- Click on the single record from the column
- Archive it
- Using the breadcrumbs, go back to the kanban view

=> The group order is not preserverd and the empty one is the last one

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

Before archiving the record, we have the following data:
`{group1: [1], group2: [2, 3]}`

After archiving the record, we have `{group2: [2, 3], group1: []}`

A new group is recreated from the old one, but it is always added at the
end.

Solution
========

We can insert the old group at his previous index.
The same solution was used in previous versions

opw-3816409

closes odoo/odoo#160121

X-original-commit: 0d44e931c40fbca005b8d1864cf2d07485ed84f8
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-04-04 09:52:49 +00:00
Julien Banken b1b836856c [FIX] web: prevent crash when closing the emoji picker
Currently, the emoji picker uses the `onWillUnmount` hook to detect when
the popover element is closed. The code defined in this hook accesses the
component's DOM and retrieves the scroll offset of the emoji picker's
scroll view. The scroll offset will then be saved and restored the next
time the emoji picker is opened by the user.

Unfortunately, it happens that the emoji picker's scroll view is no longer
in the DOM when the popover is closed and when the callback function
passed to the `onWillUnmount` hook is called. When this happens, the
system will log an error to the console (`TypeError: this.gridRef.el
is null`) and the user will not be able to reopen the emoji picker.

To fix this, we simply check that the emoji picker's scroll view exists
before retrieving the scroll offset of the element in the `onWillUnmount`
hook. This fix will prevent the error while keeping the code simple.

Steps to reproduce the issue:
1. Click on the article emoji
2. Click out of the dropdown to close it
3. Click on the article emoji again

=> The emoji picker no longer appear.

TO BE: The emoji picker should reappear when the user clicks on the emoji.

task-3818728

closes odoo/odoo#160353

X-original-commit: 6ae04b576a3f3b74febf029383c0f6d9ca5744cf
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Julien Banken (jbn) <jbn@odoo.com>
2024-04-04 08:18:54 +00:00
Akshat Trivedi a54e64d720 [IMP] web: allow to give a maximum of file to upload in m2m binary
People may have used a m2m where we don't really want a m2m relationship.

Task-3605612 (WhatsApp: Fix header / upload / reporting usage)

closes odoo/odoo#160332

X-original-commit: 910e41baf0d6ab558c53d41e511b3f10bf9860ad
Related: odoo/enterprise#59987
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-04-03 16:27:12 +00:00
Benjamin Vray fb63a42a17 [IMP] web: update the colorpicker on hex color input's input event
This commit improves the UX of the color picker's hex input in two ways:

- If the user enters a hex color without the "#" symbol, it's
automatically added.
- As soon as a valid hexadecimal color is entered in the input, the
colorpicker updates, and the color is applied to the target element.

task-3747408

closes odoo/odoo#157034

Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
2024-04-03 14:29:08 +00:00
Jorge Pinna Puissant 740fb9ac8c [FIX] web: add more details when an error dialog is detected
Before this commit, when the clickbot detected an error dialog, it
stopped the test and throw an error saying that an error dialog was
detected. This information is not enough to check why, and how, the
error dialog was produced.

Now, we also log the content of the error dialog as well as all the
information of the last rpc that was in error.

closes odoo/odoo#160103

closes odoo/odoo#160272

X-original-commit: 4f26b324a30c5120ea60b6b42fef6cd6000d2859
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2024-04-03 10:48:18 +00:00
qsm-odoo b95edd874c [FIX] web: prevent traceback for addButtonLoadingEffect in custo
Follow-up of [1] which changed code in stable in such a way it could
break when the function was used in a way it was not intended to in
some custom code. Note that the function could also be used by giving a
string selector to it, that will not work anymore: but instead of
crashing, this commit will just make it do nothing (it is only about
adding a button loading effect anyway).

[1]: https://github.com/odoo/odoo/commit/8bd51d060a48378652ae10c57a1949c3bb7d78de

closes odoo/odoo#160253

X-original-commit: d703125766d27ff33659c38fa50c2266f5f3dabb
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2024-04-02 21:35:21 +00:00
qsm-odoo 8d830ac484 [IMP] website, web: add loading effect on buttons during lazy-loading
Odoo implements its own lazy-loading mechanism for the biggest JS
bundles that are loaded on the frontend. This mechanism allows the page
to appear to the user very fast, at the downside of having some
interactive elements (such as buttons) have no effect during the lazy
loading. In general, this is not a problem since:
- Standard links and buttons work, only those with custom effects (a
  modal, a custom JS behavior, etc) have no effect.
- The full loading should not take long anyway.
- After the pages have been visited, everything should be in cache.

However, in some cases (countries with poor internet connections), the
experience can be confusing. Without lazy loading, they would have a
page that appears as a blank white page for a few seconds. With our
custom lazy loading, they get the website very fast... but some buttons
appear buggy (no effect) for a few seconds.

The long term plan is to review our lazy loading:
- Should it be less delayed than it currently is? (at the time, this was
  the minimum delay that made Google give us good page scoring but it
  may not be as impacting as before)
- Should some of the lazy-loaded JS should actually not be?
- Should the assets be split differently?
- Could we be able to remove some code that weighs too much?
- ...?

Meanwhile, this commit improves the behavior this way: during lazy
loading, any click on a button is now ignored but a loading effect is
displayed. Once the JS is fully loaded, the click is then re-played on
the previously clicked button, hopefully triggering its effect. In any
case, this cannot be worse than what we have before... except for:

- The reasonable risk we take merging this in stable (we considered
  merging in a more recent version but it is needed for some specific
  projects and many websites would benefit from this improvement).

- Any custom code that added behavior on buttons to be available during
  lazy loading... will just wait for lazy loading with a loading effect
  too now. This should be a good compromise as, again, that lazy loading
  is cached and should not take too long anyway.

Note that this replaces the previous o_wait_lazy_js class behavior (it
has now no effect).

Overall:
- This should not impact (neither improve nor worsen) most websites that
  are currently experienced from good internet connections.
- This should be a big improvement for most websites that are currently
  experienced from bad internet connections.

Related to task-3770362

closes odoo/odoo#159680

X-original-commit: 6aeebe47dd552144fabd42ddb190021f1499e38a
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2024-04-02 15:40:27 +00:00
qsm-odoo 0d7b7c792b [IMP] web: reorganize the lazyloader code a bit
As a preparation for the upcoming improvements in the lazyloader, this
moves the code around a bit. This will ease the review later. This
also actually removes code that was totally useless in that moved code.

Related to task-3770362

X-original-commit: aef5a7631723f3e26425427a963c1a0dd7b6d133
Part-of: odoo/odoo#159680
2024-04-02 15:40:27 +00:00
qsm-odoo cca8ec712a [MOV] web: move some DOM utils to the non-lazy loaded bundle
In the future, we might want to make most utils available in the non
lazy JS bundle part. We are also considering moving the Bootstrap lib
and some more in there. This commit is about moving the strict minimum
to be able to improve the lazy loading behavior in stable: the DOM utils
that allow to make async handlers and create button loading effects when
we click on them.

This also means that those utils were adapted to not use jQuery and
other non available utils.

Related to task-3770362

X-original-commit: 2e922105d8714704b3db94966defc922297e2ab6
Part-of: odoo/odoo#159680
2024-04-02 15:40:27 +00:00
Aaron Bohy 64fc675472 [FIX] web: do not save readonly fields inside x2manys
Have an x2many with several pages containing a field with a
readonly modifier (in the view, not in the field definition), e.g.
`readonly="1"` in the arch. Have an onchange that returns an
UPDATE command for a record that isn't in page 1 (so a record we
haven't read), with a value for that readonly field. Before this
commit, the value was sent in the UPDATE command, even though
readonly fields shouldn't be sent.

The difficulty here is that we can't always evaluate those readonly
expressions, as they can depend on other fields, which we didn't
read if the record is in a page we didn't browse to yet. However,
"static" expression like `"1"`, or `"context.get('something')"`
can totally be evaluated, and they should. This is what this commit
does.

Steps to reproduce the issue:
 - Install mrp
 - Go to Manufacturing > Products > Bill of Materials
 - New:
    - Product: quick create "B1"
    - Components: two lines: quick create "C1" and "C2"
    - Save
 - Manufacturing > Operations > Manufacturing Orders
 - New [in that form view, set the limit of the x2many to 1]:
    - Product: "B1"
    - Save
    - Change quantity to 2
    - Save
     => Invalid Operation

opw 3819253

closes odoo/odoo#160129

Signed-off-by: Géry Debongnie <ged@odoo.com>
2024-04-02 13:55:44 +00:00
Achraf 8228c45174 [FIX] web: Allow users to delete sorted record in a list
In some cases, sorting a sub-view list and then deleting one of its rows can cause a traceback.
This commit corrects this situation.

Here's a way to reproduce the error:
- Install `sale_management`
- Open a quotation
- Put enough elements to have two pages
- Modify the view via debug mode and change the list view limit from "200" to "2".
- Add 4 elements
- Sort with `product_uom_qty` field
- Attempt to delete the second element (i.e. the last element on the first page)

When deleting this line, a traceback is raised

Let's say we have 4 records with the following data
Page 1 (`1 - 2 / 4`):

| ID | Product | Quantity |
|----|---------|----------|
| 1  | Table   | 6        |
| 2  | Lamp    | 1        |

Page 2 (`3 - 4 / 4`):

| ID | Product | Quantity |
|----|---------|----------|
| 3  | Chair   | 4        |
| 4  | Board   | 3        |

In this case we have two cached elements: the two elements visible on
the first page.

In the cache we have two complete records, by complete we mean a record
containing all the fields, for example:

```js
{
    "1": {
        id: "datapoint_4",
        ...
        data: {
           sequence: 10,
           name: "Table",
           product_uom_qty: 6,
           display_type: false
           ...
        }
    },
    "2": {
        id: "datapoint_11",
        ...
        data: {
           sequence: 10,
           name: "Lamp",
           product_uom_qty: 1,
           display_type: false
           ...
        }
    }
}
```

After sorting by quantity, we end up with

Page 1 (`1 - 2 / 4`):

| ID | Product | Quantity |
|----|---------|----------|
| 2  | Lamp    | 1        |
| 4  | Board   | 3        |

Page 2 (`3 - 4 / 4`):

| ID | Product | Quantity |
|----|---------|----------|
| 3  | Chair   | 4        |
| 1  | Table   | 6        |

It also changes at cache level, since we sorted via the `product_uom_qty`
field, we had to go and read the records on the next page (despite the
fact that they weren't displayed).

But as we only need the quantity information, we only fetch this field
from the records on the following pages.

In terms of cache, we have something like this

```js
{
    "1": {
        id: "datapoint_45",
        ...
        data: {
           sequence: 10,
           name: "Lamp",
           product_uom_qty: 1,
           display_type: false
           ...
        }
    },
    "3": {
        id: "datapoint_16",
        ...
        data: {
           sequence: 10,
           name: "Board",
           product_uom_qty: 3,
           display_type: false
           ...
        }
    },
    "4": {
        id: "datapoint_32",
        ...
        data: {
           sequence: 10,
           name: "Table",
           product_uom_qty: 6,
           display_type: false
           ...
        }
    },
    "2": { //Chair
        id: "datapoint_1",
        ...
        data: {
           sequence: 10,
           product_uom_qty: 4,
        }
    }
}
```
We therefore have one new incomplete record in the cache

The problem will occur when we try to delete a record from the first page,
if we delete `Board`, to have this

Page 1 (`1 - 2 / 3`):

| ID | Product | Quantity |
|----|---------|----------|
| 2  | Lamp    | 1        |
| 3  | Chair   | 4        |

Page 2 (`3 - 3 / 3`):

| ID | Product | Quantity |
|----|---------|----------|
| 1  | Table   | 6        |

So we'll have to move the table that was on page 2 to page 1 (in our
case `Table`), except that when we render the list we'll have to compute
the required/readonly/invisible elements, and if we have a field that
has a readonly with the condition `not display_type` in our view, this
will cause a traceback because in the cache we only have this
```js
    "4": { //Chair
        id: "datapoint_32",
        ...
        data: {
           sequence: 10,
           product_uom_qty: 4,
        }
    },
```
`display_type` is definitely not in the data because we considered this
cached record to be complete.

This commit modifies the `StaticList._applyCommands` function to create
datapoints for all records that are not **entirely** loaded via `StaticList._getResIdsToLoad`.

https://github.com/odoo/odoo/blob/00898aef4dbeb469e0cec7eaea387de2755c6426/addons/web/static/src/model/relational_model/static_list.js#L898-L912

opw-3771077

closes odoo/odoo#159264

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-04-02 12:09:30 +00:00
Odoo Translation Bot 684745f5de [I18N] Update translation terms from Transifex 2024-03-31 00:09:16 +01:00
Mathieu Duckerts-Antoine 7ac5dcce09 [FIX] web: WithSearch: filtering search defaults
Before that commit, the search defaults would not be filtered when the
WithSearch is started with a search model state or updated by its parent.

closes odoo/odoo#159406

X-original-commit: dac527b7baa699cef0828a9d87a4c814ff3f7f05
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2024-03-27 16:11:00 +00:00
Pierre Paridans 9c31da401d [FIX] web: handle MouseEvent triggered from TEXT_NODE in Firefox
This commit "fixes" a weird behavior in Firefox where a MouseEvent
("mouseenter" in this case) can be triggered from the target's
TEXT_NODE, even if it shouldn't...

Note: even though this isn't clearly defined in the spec, MouseEvent
shouldn't be dispatched for TEXT_NODE, as implemented in Blink or
WebKit... But not everyone agrees (cf. tickets linked below).

Steps to reproduce:
- open website
- go into edit mode
- actually edit the page
- add a snippet to the page
- click on the "Discard" button and move very fast out of it
=> the error `el.matches is not a function` is "sometimes" raised (if
you got the right timing)

References:
- https://w3c.github.io/uievents/#event-type-mouseenter
- https://bugzilla.mozilla.org/show_bug.cgi?id=185889
- https://bugzilla.mozilla.org/show_bug.cgi?id=42717
- https://bugzilla.mozilla.org/show_bug.cgi?id=103055

closes odoo/odoo#158810

Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2024-03-27 10:59:17 +00:00
amdi-odoo 65cd911a5a [FIX] web: fix properties mobile display
Fix the property mobile display:

- Set the popup in fullscreen.
- The draggable feature is disabled.
- Replacing the move up/move down property arrows in the popup by a
back arrow so that the fullscreen popup can be closed.
- Removing the min-width on the property popover to prevent the popup
from going out of the screen.
- Edit button is now always visible as hovering on it is not possible on mobile.

Task-3635554

closes odoo/odoo#156886

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2024-03-27 10:59:16 +00:00
Jorge Pinna Puissant 08081fc742 [FIX] web: buttons with special attr close, close x2many dialogs
Before this commit, if a button had the attribute special="close" on the
footer of an x2many dialog, the dialog was not closed.

This occurs because the view button hook searches the dialog close
functions put in the environment by the dialog component, and in this
case is another component that initialize the hook, and the function is
not found.

Now, the view button hook will use the dialog close function put in the
environment by the dialog service.

closes odoo/odoo#159121

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-03-26 11:40:18 +00:00
Brieuc-brd 3bf4fa0ac6 [MOV] web: allow oi icons to flip in RTL frontend
Prior to this commit, `oi` icons were not adapted when RTL was defined
in frontend.
This is because RTL adaptations were defined in the backend bundle.

This commit moves the RTL adaptations to be used wherever `oi` icons can
be defined.

Steps to reproduce :
- Enter in edit mode
- Drag and drop an image gallery and a carousel snippet
- Navigate to the theme tab
- Add an RTL language (Arabic, for instance)

Bugs :
- The image gallery displays inverted chevrons
- The carousel's chevrons are correct, but clicking on "previous"
  displays the next picture, and vice versa.

Also, some icons a bit everywhere in the apps were not rotated either.
For instance, the back button a forum post to go back to the forum.

Note that task-3714335 will replace FA icons by BS icons, and will
triple check Odoo icons at the same time, to ensure all Odoo icons are
available in the frontend and correctly imported. For instance,
`oi-spin` and `oi-pulse` could make sense in the frontend too.

opw-3747848
task-3794966

closes odoo/odoo#159150

X-original-commit: fc105130551cf9897c7a0a78baf4458e6d5e6fd8
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2024-03-26 09:54:29 +00:00
Brieuc-brd e9163303d4 [FIX] web: adjust hatched events for planning
Prior to this commit, the "hatched" event style in Planning wasn't
displayed in Day and Week views.
This commit adjusts the css selector to fix this issue.

task-3617329
Part of task-3575827

closes odoo/odoo#154964

Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2024-03-26 09:54:19 +00:00
Brieuc-brd 2b967b59ee [MOV] web, calendar: move common scss into web
Prior to this commit, some of the main styles related to event elements
in calendars were set in the Calendar module.
This created layout issues when we installed independent modules without
installing the Calendar module (eg. `planning` or `hr_payroll`).

To fix that, this commit moves the necessary styles into `web`.

task-3617329
Part of task-3575827

Part-of: odoo/odoo#154964
2024-03-26 09:54:19 +00:00
Odoo Translation Bot 395140671f [I18N] Update translation terms from Transifex 2024-03-24 00:12:07 +01:00
Xavier Luyckx (xlu) 5fc2e57d26 [FIX] web, website, mass_mailing: Update X/Twitter logo
This commit introduces an update to the Font Awesome library,
specifically replacing the X/Twitter icon with its new design. It also
involves adjustments to a few images and SVG files to incorporate the
updated X/Twitter logo.

Technical note: It updates an existing file, originally modified for the
addition of the TikTok icon, which was not available in Font Awesome 4.

task-3463530

closes odoo/odoo#158586

X-original-commit: 34cba04a452f2da21f3418d6fc48a484da8ecd27
Related: odoo/enterprise#59147
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2024-03-22 20:01:24 +00:00
Mahamadasif Ansari eb0cc88ba5 [FIX] web: log logger warning instead error in assets
Currently, log level error mesage occur when`ValueError` is catched by line [1].

This commit changes 'logger.error' to 'logger.warning' with filename to
log message instead of error since this is not an actual error of the codebase.

[1]-https://github.com/odoo/odoo/blob/3932c46f914c40be4b0629771d1981cdf289df26/addons/web/controllers/binary.py#L131

sentry-4657682601

closes odoo/odoo#158342

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2024-03-22 14:47:55 +00:00
Paolo Gatti (pgi) efd89d8483 [FIX] base, web: BooleanFavoriteField wasn't translated
- BooleanFavouriteField wasn't translated as the component was using
  an untranslated variable instead of relying on the translation of
  the template.

Some other translation fixing:
- ID Azienda is very generic, the correct name is Numero REA:
  See: https://www.registroimprese.it/codice-fiscale-p.iva-rea
- No one calls a mobile phone "Dispositivo mobile", we already
  translate it as the more common "Cellulare" even in the same file

task-3263708

closes odoo/odoo#157949

Signed-off-by: Paolo Gatti (pgi) <pgi@odoo.com>
2024-03-22 14:47:53 +00:00
Hubert Van De Walle ec5059f353 [FIX] web: prevent double translations in views
Steps to reproduce
==================

In 17:
- Install hr_holidays,project
- Switch the language to dutch
- Go to project > three dots > Projectupdates

We can see `x/y Genomen`, it should be `x/y Taken`

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

The original term is Tasks.
When loading the views, python translates them and changes Tasks to Taken.
Owl then translates the template and transforms Taken to Genomen.

Solution
========

Since the views are already translated, we don't need to translate them with owl.
We can simply set the attribute t-translation to off on the view root node.

opw-3787336

closes odoo/odoo#158627

X-original-commit: 454760e12145f8987e443d7776a614a5eb441feb
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2024-03-22 03:11:43 +00:00
Lucas Perais d8024733a7 [FIX] web: codeEditor: initial value is not up to be undone
Open the code editor (wrapper around aceEditor) with an initial value -- in Odoo, that is any instance of the code editor.
Press Ctrl+Z.

Before this commit, the value disappears -- is undone -- even though no real change happened.
This was because we used editor.setValue, instead of editor.session.setValue. The latter resetting the undo history.

This behavior is "documented" [here: Common Operations](https://ace.c9.io/#nav=howto) with:
```js
//Set and get content:

editor.setValue("the new text here");
editor.setValue("text2", -1); // set value and move cursor to the start of the text
editor.session.setValue("the new text here"); // set value and reset undo history
editor.getValue(); // or session.getValue
```

After this commit, the initial value is not undoable.

opw-3793546

closes odoo/odoo#158548

X-original-commit: b33086599383a4c0ab43126598a63e8721f682fc
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2024-03-21 23:03:04 +00:00
Benjamin Vray 618fbc1a54 [FIX] web, web_editor: fix text muted within a dropdown menu
Steps to reproduce the bug:

- Install the "Blogs" app and go to the "/blog" page.
- Click on "Edit" to enter edit mode.
- Go to the "Theme" tab.
- Select the 4th color from the theme colors and choose "black".
- Save the page to exit edit mode.
- Perform a search in the search bar input that yields no results, for
example: "zzz".
- Bug: The message "No results found. Please try another search." is not
visible because it is displayed in white on the white background of the
dropdown.

A previous commit [1] had already addressed the issue for the "Search"
snippet that can be dropped into a page, but this fix wasn't sufficient
to solve the problem everywhere. Indeed, the text-muted in a dropdown
should be adjusted in all cases and not just for snippets; it's a
Bootstrap issue. The text-muted color should be adapted to the
background color of the dropdown.

[1]: https://github.com/odoo/odoo/commit/f9bf40cb53cf487c8736c1f565c2f0d3834acd5e

task-3662985

closes odoo/odoo#158203

X-original-commit: 46fcb3712f0ba68144b03ed23f52157d4dfc789a
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
2024-03-20 13:52:31 +00:00
Julien Carion (juca) f66eaebc70 [IMP] web: pivot: keep horizontal scrollbar inside viewport
This commit simply removes the table-responsive class from the pivot
view in desktop mode so that its eventual horizontal scrollbar will
remain inside the viewport instead of being positioned at the very
bottom of the page. Also hides the scrollbar in sample data mode so that
the user cannot scroll horizontally in this case which introduces weird
display.

closes odoo/odoo#158083

Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2024-03-20 13:52:23 +00:00
Aaron Bohy 2176cadebd [FIX] web: multi level grouped list: correct pager inside groups
Have a list view with multiple groupbys and a lot of records to
have pagers displayed. Open a group (first level). The pager of the
group uses the number of records instead of number of (inner)
groups as total.

This commit fixes the issue. The pager now correctly allows to
navigate through inner groups.

closes odoo/odoo#157995

Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2024-03-19 09:24:20 +00:00
Odoo Translation Bot c4bc200b47 [I18N] Update translation terms from Transifex 2024-03-17 00:11:43 +01:00
AH-Yussef 58790d58e1 [FIX] web: correctly align column values with column header
Steps to reproduce:
- Install planning app.
- Go to planning app, and convert the view to List.
- Group by Resource -for example-.
- Notice how the allocated time values are mis-aligned with the header label.

Investigation:
- in the planning tree view, notice the property `open_form_view` set to `True` https://github.com/odoo/enterprise/blob/418ea2114c7d935865dc52e5fd5a30d626987190/planning/views/planning_views.xml#L8
- In the `getGroupNameCellColSpan` method:
	- the `firstAggregateIndex` is `1` belonging to the `allocated_hours` (Allocated Time)column which set the `colspan = firstAggregateIndex = 1`
	- as `this.hasSelectors` is `true`, `colspan = colspan+1 = 2` (which is the correct value)
	- but now as the `open_form_view` was set to `True`, the `this.props.onOpenFormView` exists and so the `colspan = colspan+1 = 3` which makes the value be misaligned to the right by one column.

The proposed fix:
- As the `open_form_view` option add a View button to the end of the row, it makes sense to do the check with the `lastAggregateIndex` inside `getGroupPagerCellColspan` method.
- In our case:
	- the `lastAggregateIndex` is `1` belonging also to the `allocated_hours` which set the `colspan = this.state.columns.length - lastAggregateIndex - 1 = 3 - 1 - 1 = 1`
	- as we don't display optional fields this check fails https://github.com/odoo/odoo/blob/5af3cfc2b9ce648ae4aff69150266e4ad519050d/addons/web/static/src/views/list/list_renderer.js#L1025-L1027 and the `colspan = 1`
	- Now we check the `this.props.onOpenFormView` condition which set `colspan = colspan+1 = 2` which is correct.
- But what if we wanted to show the optional field `allocated_percentage` would this fix still work? Yes!
	- the `lastAggregateIndex` is `2` belonging to the `allocated_percentage` which set the `colspan = this.state.columns.length - lastAggregateIndex - 1 = 3 - 2 - 1 = 0`
	- as we do display an optional fields= this check works https://github.com/odoo/odoo/blob/5af3cfc2b9ce648ae4aff69150266e4ad519050d/addons/web/static/src/views/list/list_renderer.js#L1025-L1027 and the `colspan = colspan+1 = 2`
	- Now we check the `this.props.onOpenFormView` condition which set `colspan = colspan+1 = 3` which is correct.
- One last case, what if we have no aggregates
	- both firstAggregateIndex` = `lastAggregateIndex` = -1
	- we go into the else clause inside `getGroupPagerCellColspan`, making the `colspan = this.state.columns.length > 1 ? DEFAULT_GROUP_PAGER_COLSPAN : 0 = True ? DEFAULT_GROUP_PAGER_COLSPAN : 0 = DEFAULT_GROUP_PAGER_COLSPAN = 1
	- if the `open_form_view` was `True`, the colspan becomes `colspan = colspan+1 = 2`.

opw-3764616

closes odoo/odoo#156647

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-03-14 08:06:21 +00:00
Aaron Bohy 96e3782a14 [FIX] web: ButtonBox: do not display More for one button
Before this commit, it could happen that the More dropdown was
displayed, but it only contained a single stat button. This isn't
what we want, as that single button could simply be displayed
instead of the More dropdown toggler.

Task 3778382

closes odoo/odoo#156241

Related: odoo/enterprise#58565
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2024-03-13 12:28:18 +00:00
Benjamin Vray fdfb1c38f2 [FIX] web: fix colors contrast in searchbar input
Steps to reproduce the bug:

- Open the homepage and enter edit mode.
- Click on the "Theme" tab.
- Select the 4th color from the theme options and choose "black".
- Drag and drop a "Search" snippet onto the page.
- Save the page to exit edit mode.
- Enter text in the searchbar input.
- Bug: The text is not visible because its color is the same as the
background color of the input.

This bug appeared since this commit [1] where the "bg-light" class was
added to the searchbar input. This caused the text color of the input,
which by default is the same as the body color, to become invisible when
the background color of the body is dark.

To fix this, we now adjust the text color of the input based on the
background color of the input.

[1]: https://github.com/odoo/odoo/commit/6b1d11a60d8e70b33c63da860bb81b015ce5ea20

task-3751401

closes odoo/odoo#156042

Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
2024-03-12 16:59:05 +00:00
Aaron Bohy 42712709fb [FIX] web: fix ImageField test failing sometimes
Before this commit, the changed test sometimes failed because we
expected the image to be set, but it wasn't (yet). This commit
increases the delay.

Runbot error 56099

closes odoo/odoo#157347

X-original-commit: 289e2b20673ba44fb8ce7afe19bae3bfa94e5f8c
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-03-12 11:55:41 +00:00
fja-odoo 53d6d795dd [FIX] web: fix image cache in kanban/activity view
The way we cache the image is not right when that image is not on the
current record. For instance displaying a partner/user image. The unique
key used is not related to that record.

Introduced by https://github.com/odoo/odoo/pull/97544

closes odoo/odoo#157199

X-original-commit: d127ec26d8e8d42c0e25668797cbd0f37203dc52
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
Signed-off-by: fja-odoo <fja@odoo.com>
2024-03-12 01:50:05 +00:00
mano-odoo 6abd479dca [FIX] web: handle the alert margin in form_controller styling
Since Milk redesign the margin bottom on the alerts displayed above the
sheet in a form view should be mb-2 (equivalent of the margin-bottom of
the statusbar). Some alerts across Odoo were still inconsistent.

This commit introduces a custom property `--alert-margin-bottom` which
allows the customization of the alert's margin bottom depending on its
context.

This ensure that an alert rendered in the form view above the form_sheet
will receive the appropriate margin as long as there is no utility class
or override on the alert with this property.

There the last alert gets a margin of mb-2 and if multiple alerts are
displayed the ones above the last one get a margin equivalent to mb-1.

task-3577058

Part-of: odoo/odoo#156927
2024-03-11 16:37:34 +00:00
Hubert Van De Walle bc326fa21e [FIX] web: prevent multiple updates when pressing enter
Steps to reproduce
==================

In 16.4:
- Go to Accounting > Reconcile 8 items
- Click on the first line on the right
- Edit the label and then press Enter
- Switch to another line

=> Odoo Server Error

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

When pressing Enter, two events are triggered: keydown and change.
In the useInputField hook, there is a listener for both of those events,
and they both end up calling `record.update` with the current value from
the input.

In the relational model, the update is locked inside a mutex.

So the first update (triggered by the keydown) does an onchange.
This onchange deletes the current records (Command.CLEAR) and returns
new records.

Once this is done, the mutex is released. The second update (triggered
by the change event) then tries the same update. Since the value was
obtained when queuing for the mutex, it uses the old (now deleted)
record.

Solution
========

This adds a test for https://github.com/odoo/odoo/pull/154991
as part of the fix got lost in a conflict resolution for previous versions.

opw-3726818

closes odoo/odoo#157155

X-original-commit: fbebffe446de9dd80db2dbe5ca7bd2746dc2a54f
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2024-03-11 11:55:08 +00:00
Odoo Translation Bot 1b9fd01d46 [I18N] Update translation terms from Transifex 2024-03-10 00:13:03 +01:00
Dylan Kiss (dyki) 1a0e3ee5c1 [FIX] web: make "Save current search" translatable again
Due to a refactor of the code in [1], the string "Save current search"
in the filters dropdown was not translatable anymore.

This commit fixes that, so it is translatable again.

[1] 976491e012

closes odoo/odoo#156946

X-original-commit: 5f1d6f26d6bfe1f23f4098eae2e0b32300adefda
Signed-off-by: Tiffany Chang (tic) <tic@odoo.com>
Signed-off-by: Dylan Kiss (dyki) <dyki@odoo.com>
2024-03-08 12:48:59 +00:00
Benjamin Vray 9561a2df74 [FIX] web: fix border radius of buttons within input-group
Since the commit [1] introducing Bootstrap 5, buttons within input
groups (e.g., "search bars") no longer have the same border-radius as
the inputs.

Steps to reproduce the bug:
- In Website edit mode, drag and drop a "Search" snippet onto the page.
- Click on the "Theme" tab.
- Set the inputs "Border Radius" option to 25px.
- Bug: The border-radius is not applied to the right side of the search
bar.

[1]: https://github.com/odoo/odoo/commit/9ea13513342b14e6b8d4e10e162b618a6ab2cce0

task-3662985

closes odoo/odoo#156603

X-original-commit: 58b57af056a83cda3d8caa6c22d8564c3f9816c9
Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
2024-03-06 12:46:15 +00:00
Victor FeyensandAaron Bohy 6a83ace2b1 [FIX] web: x2many field with empty changes
In some conditions, a x2many field can be considered
as modified by the webclient when in fact there is
no change in 'meaningful' stored fields.

In this case, on save, an empty list of magic commands
will be sent to the server, potentially triggering
unexpected recomputations.

Steps to reproduce:

* install sale_stock & sale_management
* create a new storable product
* create a new SO
* create a new line with this product
* Confirm the SO
* Set or Update the SO delivery date (Other info tab)
* Save

-> In the chatter, you will notice an useless tracking
value being printed for the SO Total, with identical values
before and after update.

Cause

Since the server received an empty list of commands for
the `order_line` field, this triggered a recomputation
of the total amounts of the SO, even though there were no
effective changes in the lines.

Solution

Do not send empty command lists for x2m fields.
This will avoid unexpected recomputation and also improve
performance since the fields were recomputed for 'nothing'

closes odoo/odoo#155549

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2024-03-05 16:48:16 +00:00
std-odoo 5b9cfff00c [FIX] web: properties, date / datetime default values are never set
Bug
===
Since c5b87e130b , the Date / Datetime
are not formatted the way they suppose to be. So the value is not
correct (it contains the timezone, etc).

Because of that, the string "Invalid Date" is stored in database
instead of "YYY-mm-dd" when we change the default value in the
definition.

Task-3774178

closes odoo/odoo#155749

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2024-03-04 11:29:45 +00:00
Simon Genin (ges) 841ace40ce [FIX] web: valid, then invalid, then valid field value is correct
The commit 7452f855f05251a5458ddb4d654b03be1b179d40 was fixing the
problem in a simple way. It however wasn't good enough of a fix as we
discovered we were triggering too many onChange after the forward port.

So we revert commit 7452f855, and backport 5ffc604 from 17.1. It adds
a method on the model to reset the validity of a field.

It was not what felt the best, but as it is working and we just want to
fix the problem in stable, we go for it.

opw 3680495

closes odoo/odoo#156139

X-original-commit: 2fa3fd751a968a15a76d322c53241022b4b18ef3
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2024-03-04 09:52:05 +00:00
Odoo Translation Bot cb45934163 [I18N] Update translation terms from Transifex 2024-03-03 00:09:56 +01:00
fdardenne f6dd7604db [FIX] web: correctly set the user settings
User settings is used to store user's preferences, in web we use it
to store the home menus apps order and in mail for various settings like
push to talk key, discuss sidebar preferences, etc.

Before this commit, the `setUserSettings` method from the user service
overrided all the previous key that has not been changed because it
kept only the changed keys returned by the backend.
Leading to preferences being lost during the session when reordering the
home menu apps.

With this commit, we keep the previous keys that have not been changed.

Steps to reproduce:

- Go to the home menu
- In the Owl devtool check the settings object from the user service:
```JavaScript
{
    "id": 1,
    "user_id": {
        "id": 2
    },
    "is_discuss_sidebar_category_channel_open": true,
    "is_discuss_sidebar_category_chat_open": true,
    "push_to_talk_key": false,
    "use_push_to_talk": false,
    "voice_active_duration": 0,
    "volume_settings_ids": [
        [
            "ADD",
            []
        ]
    ],
    "homemenu_config": "[\"mail.menu_root_discuss\",\"room.room_menu_root\",\"calendar.mail_menu_calendar\",\"appointment.main_menu_appointments\",\"project_todo.menu_todo_todos\",\"membership.menu_association\",\"knowledge.knowledge_menu_root\",\"contacts.menu_contacts\",\"frontdesk.frontdesk_menu_root\",\"point_of_sale.menu_point_root\",\"crm.crm_menu_root\",\"sale.sale_menu_root\",\"spreadsheet_dashboard.spreadsheet_dashboard_menu_root\",\"sale_subscription.menu_sale_subscription_root\",\"sale_renting.rental_menu_root\",\"pos_preparation_display.menu_point_kitchen_display_root\",\"account_accountant.menu_accounting\",\"documents.menu_root\",\"project.menu_main_pm\",\"hr_timesheet.timesheet_menu_root\",\"industry_fsm.fsm_menu_root\",\"planning.planning_menu_root\",\"helpdesk.menu_helpdesk_root\",\"website.menu_website_configuration\",\"website_slides.website_slides_menu_root\",\"social.menu_social_global\",\"marketing_automation.marketing_automation_menu\",\"mass_mailing.mass_mailing_menu_root\",\"mass_mailing_sms.mass_mailing_sms_menu_root\",\"event.event_main_menu\",\"survey.menu_surveys\",\"purchase.menu_purchase_root\",\"stock.menu_stock_root\",\"mrp.menu_mrp_root\",\"mrp_workorder.menu_mrp_workorder_root\",\"quality_control.menu_quality_root\",\"stock_barcode.stock_barcode_menu\",\"maintenance.menu_maintenance_title\",\"repair.menu_repair_order\",\"mrp_plm.menu_mrp_plm_root\",\"account_consolidation.menu_consolidation\",\"sign.menu_document\",\"hr.menu_hr_root\",\"hr_work_entry_contract_enterprise.menu_hr_payroll_root\",\"hr_appraisal.menu_hr_appraisal_root\",\"hr_attendance.menu_hr_attendance_root\",\"hr_recruitment.menu_hr_recruitment_root\",\"hr_referral.menu_hr_referral_root\",\"fleet.menu_root\",\"hr_holidays.menu_hr_holidays_root\",\"hr_expense.menu_hr_expense_root\",\"lunch.menu_lunch\",\"im_livechat.menu_livechat_root\",\"data_recycle.menu_data_cleaning_root\",\"approvals.approvals_menu_root\",\"whatsapp.whatsapp_menu_main\",\"iot.iot_menu_root\",\"base.menu_management\",\"base.menu_tests\",\"base.menu_administration\"]",
    "voip_username": false,
    "voip_secret": false,
    "should_call_from_another_device": false,
    "external_device_number": false,
    "should_auto_reject_incoming_calls": false,
    "how_to_call_on_mobile": "ask",
    "is_discuss_sidebar_category_whatsapp_open": true,
    "onsip_auth_username": false,
    "livechat_username": false,
    "livechat_lang_ids": [],
    "is_discuss_sidebar_category_livechat_open": true
}
```
- Reorder an app in the home menu and check again the settings object:
```JavaScript
{
    "id": 1,
    "homemenu_config": "[\"mail.menu_root_discuss\",\"room.room_menu_root\",\"project_todo.menu_todo_todos\",\"calendar.mail_menu_calendar\",\"appointment.main_menu_appointments\",\"membership.menu_association\",\"knowledge.knowledge_menu_root\",\"contacts.menu_contacts\",\"frontdesk.frontdesk_menu_root\",\"point_of_sale.menu_point_root\",\"crm.crm_menu_root\",\"sale.sale_menu_root\",\"spreadsheet_dashboard.spreadsheet_dashboard_menu_root\",\"sale_subscription.menu_sale_subscription_root\",\"sale_renting.rental_menu_root\",\"pos_preparation_display.menu_point_kitchen_display_root\",\"account_accountant.menu_accounting\",\"documents.menu_root\",\"project.menu_main_pm\",\"hr_timesheet.timesheet_menu_root\",\"industry_fsm.fsm_menu_root\",\"planning.planning_menu_root\",\"helpdesk.menu_helpdesk_root\",\"website.menu_website_configuration\",\"website_slides.website_slides_menu_root\",\"social.menu_social_global\",\"marketing_automation.marketing_automation_menu\",\"mass_mailing.mass_mailing_menu_root\",\"mass_mailing_sms.mass_mailing_sms_menu_root\",\"event.event_main_menu\",\"survey.menu_surveys\",\"purchase.menu_purchase_root\",\"stock.menu_stock_root\",\"mrp.menu_mrp_root\",\"mrp_workorder.menu_mrp_workorder_root\",\"quality_control.menu_quality_root\",\"stock_barcode.stock_barcode_menu\",\"maintenance.menu_maintenance_title\",\"repair.menu_repair_order\",\"mrp_plm.menu_mrp_plm_root\",\"account_consolidation.menu_consolidation\",\"sign.menu_document\",\"hr.menu_hr_root\",\"hr_work_entry_contract_enterprise.menu_hr_payroll_root\",\"hr_appraisal.menu_hr_appraisal_root\",\"hr_attendance.menu_hr_attendance_root\",\"hr_recruitment.menu_hr_recruitment_root\",\"hr_referral.menu_hr_referral_root\",\"fleet.menu_root\",\"hr_holidays.menu_hr_holidays_root\",\"hr_expense.menu_hr_expense_root\",\"lunch.menu_lunch\",\"im_livechat.menu_livechat_root\",\"data_recycle.menu_data_cleaning_root\",\"approvals.approvals_menu_root\",\"whatsapp.whatsapp_menu_main\",\"iot.iot_menu_root\",\"base.menu_management\",\"base.menu_tests\",\"base.menu_administration\"]"
}
```

closes odoo/odoo#155902

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2024-03-01 10:29:40 +00:00
Aaron Bohy 0dfee1606b [FIX] web: can edit SelectionField in draggable kanban
Before this commit, if a SelectionField was used in a kanban view
alongside the HandleField (enabling re-sequencing, i.e. drag&drop),
the "select" element couldn't be edited. This is because the d&d
feature calls preventDefault on almost all "pointerdown" events
occuring in the card, and the "pointerdown" event is the one that
opens the select.

There's no usecase in 17.0, but there's one in master, in the
product document kanban view.

We fix this in 17.0 which is the version that introduced the kanban
version of the SelectionField.

closes odoo/odoo#155827

Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2024-02-29 14:07:49 +00:00
omra-odoo fe4b0febaf [FIX] web: add close button in daterange picker
Current behaviour
- when we access the daterange picker it was observed that the apply button
  appeared flatter and was not vertically centered.

Expected behaviour
 - add h-100 on buttons container to ensure they are vertically centered and no
   longer appear flatter
 - add close button in which  action is similar to pressing ESC or clicking
   outside the popover

Task-3624556

closes odoo/odoo#148812

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-02-29 12:13:37 +00:00
Louis (loco) fb2296adec [IMP] *: improve accessibility of website pages
*: base_import, gamification, hr_skills, mass_mailing, portal,
portal_rating, survey, web, web_editor, website, website_sale,
website_slides

The goal of this commit is to improve the accessibility of the website
pages. This has been made by implementing and correcting ARIA
(Accessible Rich Internet Applications) roles and attributes. More
precisely:
- An `aria-label` attribute has been added on progressbar elements to
avoid a warning of type `ARIA progressbar elements do not have
accessible names`. It has also been added on iframes to avoid a warning
of type `<frame> or <iframe> elements do not have a title`. Furthermore,
`aria-label` has been incorporated on some anchors to avoid a warning of
type `Links do not have a discernible name`. Finally, it has been added
on elements that have the `dialog` role to avoid a warning of type
`Elements with role="dialog" or role="alertdialog" do not have
accessible names` and on elements that have the `listbox` role to avoid
a warning of type `ARIA input fields do not have accessible names`.
- To avoid a warning of type `Some ARIA parent roles must contain
specific child roles to perform their intended accessibility functions`,
`role="menuitem"` has been added on children of menu elements. As
explained in [the menuitem role documentation], "The `menuitem` role
indicates the element is an option in a set of choices contained by a
`menu` or `menubar`". To avoid this warning, `role="presentation"` has
also been added on elements located between `tablist` and `tab` and
between `menu` and `menuitem`. Indeed, as explained in
[the presentation role documentation]; "The `presentation` role removes
an element's implicit ARIA semantics from being exposed to the
accessibility tree". The goal is to inform the assistive technologies
that the default semantics of the element should be ignored. Finally, to
avoid this same warning, the `option` role has been added on elements to
identify selections a user can make in a `listbox`.
- The `aria-label` of some elements has been adapted in order to avoid a
warning of type `Elements with visible text labels do not have matching
accessible names`.
- The value of `aria-disabled` has been corrected to `true` (instead of
`disabled`) (see [the aria-disabled documentation]).

Still to improve the accessibility of the website pages, an alternative
text (`alt`) attribute has been provided for images.

[the menuitem role documentation]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/menuitem_role
[the presentation role documentation]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/presentation_role
[the aria-disabled documentation]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled#values

closes odoo/odoo#140453

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2024-02-29 12:13:35 +00:00
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