Commit Graph
18290 Commits
Author SHA1 Message Date
Lucas Perais c0ab464dc7 [FIX] base, web (qweb): image field in raw data mode handles options
Commit[1] implemented a way to output an image as its raw representation
`<img src="data:image/png;base64......." />`
It is useful for integrating an image of a record not accessible publicly.

However the original commit forgot to allow the img node to handle the options
passed to the field. Classes in particular were absent

After this commit, the options are handled correctly, and the image in raw mode
has the right classes.

opw-3517861

[1]: f8b901d04b

closes odoo/odoo#151410

X-original-commit: dbb22351921629aad845e29ebfa8b4083b4e745a
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2024-01-29 13:44:33 +00:00
Odoo Translation Bot 625dac5a10 [I18N] Update translation terms from Transifex 2024-01-28 00:16:34 +01: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
luvi 16251091dc [FIX] web: improve SelectMenu design in Milk
Prior to this commit, some visual style of the SelectMenu component had
not been adapted since the latest Odoo redesign (named Milk). This made
some parts of the menu inappropriate with the current padding of the input,
and the border would not fit anymore, since the input is no longer linked
to the menu.

Also, the search input no longer had a pointer: text associated, but a
pointer instead, which seems wrong as the user can type in it.

Finally, some element were not visible correctly in dark mode.

This commit improves the overall look of the SelectMenu component when being
used with this design.

closes odoo/odoo#151276

Signed-off-by: Bastien Fafchamps (bafa) <bafa@odoo.com>
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2024-01-26 07:48:54 +00:00
luvi 69d7baa7af [FIX] web: show label for null and empty strings value in SelectMenu
This commit fixes the behavior of the SelectMenu component when an option
is being used with an empty string or a null value.

Let's suppose we have the following choices:
{ label: 'Empty', value: '' },
{ label: 'Full', value: 'full' }

Before this fix, when selecting 'Empty', the value would be selected in the
menu, but the toggler would still be empty, as if no value was selected.
Now, any value corresponding to a choice value can be selected.

A test has been added for each value supported (null and empty strings).

Part-of: odoo/odoo#151276
2024-01-26 07:48:54 +00:00
Lucas Perais 65bc746390 [FIX] web: report tables vertical align cells (BS5 adapt)
Since the Bootstrap5 migration (odoo/odoo#95450), the reports' table cell were centered vertically.
This was due to the fact that the property "vertical-align" which was set on the table itself by BS5 doesn't play
nice in wkhtmltopdf, namely, it seems to not get inherited by the table's children.

This commit adapts the css by reproducing what was done in BS4 for tables.

After this commit, the table cells have their text aligned at the top by default.

opw-3670533

closes odoo/odoo#151186

X-original-commit: 1335bce8e45bab473486e87c8a430cbc6dde587b
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2024-01-25 18:13:04 +00:00
sesn-odoo 719f2dff26 [FIX] web: add text direction on PDF reports body tag
Summary
-------
wkhtmltopdf's "smart shrink" option does not work properly with rtl
languages, unless the direction is specifically set on the body/html
tag.

Steps to reproduce
------------------
* install Accounting and the Saudi Arabia localization
* switch the Saudi Company
* language to Arabic
* print the General Ledger

You should see that a few columns do not appear on the PDF. They are out
of bounds.

Cause
-----
The "smart shrink" option in `wkhtmltopdf` is a feature designed to
automatically reduce the font size of text in order to fit content
within the specified page width. We use this option to help prevent
content from overflowing the designated page boundaries.
However, it seems that "smart shrink" doesn't take into account the text
direction unless it is set on the `body` or `html` tag specifically.

opw-3472357
opw-3567655
opw-3520084

closes odoo/odoo#151049

X-original-commit: 210a529b0b43fe36f7f2e44363dfe039128f7f80
Related: odoo/enterprise#55107
Signed-off-by: Séna Serge Nshimiyimana (sesn) <sesn@odoo.com>
2024-01-25 13:42:52 +00:00
Bastien (bvdn) b45d2c96fe [FIX] web: fix calendar mobile view creation record
issue:
- calendar mobile view (month) > pressing on a day or timeframe to create a task doesn't work
if the view does not have the "day" calendar scale set up

Fix:
- We are removing the condition preventing the renderer to use the createRecord callback when
the view is Mobile and in monthly scale

So now a record will be directly created when a user clicks on a timeframe in monthly view even
if he's in mobile view

Task-3677216

closes odoo/odoo#150624

X-original-commit: da23aa3d68e0f8b833d085c09bcf81d8aa2a4285
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-25 08:29:12 +00:00
Loukas Wets (lowe) 01419ad0b8 [IMP] pos_self_order: kiosk printer
With this commit the kiosk will now print the kitchen tickets.

closes odoo/odoo#149353

Task: 3553947
Related: odoo/enterprise#54288
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2024-01-24 12:30:06 +00:00
std-odoo 9792d5d761 [FIX] web: decimal property crash in list view
Bug
===
The decimal property crash when added in a list view, if some records
have False as a value.

Technical
=========
Since fe797a03285ec9c81d29ed631839c91e2b9957a4 , we use the wrong
Formatter in the Float field.

Task-3698415

closes odoo/odoo#150682

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-24 10:44:41 +00:00
Hubert Van De Walle a76641cb06 [FIX] web: prevent empty json field from passing the required check
Steps to reproduce
==================

- Enable analytic accounting
- Go to customer invoices
- Open a record
- Open studio
- Click on the Invoice lines > Edit list view
- Set the analytic field as required
- Close studio
- Create a new record
- Add a new line
- Click on the analytic field
- Close the popup
- Save the record

=> Even though we didn't set a value for the field, it is saved

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

The actual field value is an empty object.
The validity of a field is checked here [0].
An empty object is considered a truthy value.

When setting the required attribute directly on the python field
declaration, an empty object does not pass the check

Solution
========

Add a specific check for json fields. When the value is either false
(not set) or an empty object, the field is considered invalid.

---

[0]: https://github.com/odoo/odoo/blob/23f01c533512cbfb33e90509e22cd3c3c4f99d40/addons/web/static/src/views/basic_relational_model.js#L284

opw-3659763

closes odoo/odoo#150677

X-original-commit: 51b538b3f678298f27bbbf458de5696706c18349
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2024-01-24 00:16:50 +00:00
Shubham Thanki 8da12ebd75 [FIX] mail: stop the bubbling of various click events
Technical Reason:
- The events bound to the specific elements inside the `FileViewer` are
propagating/bubbling up and are triggering the `onGlobalClick`
(https://github.com/odoo/enterprise/blob/eaf40edbbacfc6a8eb9e0137c20e7f94b1f5d723/documents/static/src/views/kanban/documents_kanban_renderer.js#L36-L42)
event bound on the `DocumentsKanbanRenderer`.
(https://github.com/odoo/enterprise/blob/71dbc617d6fe533c4d0153361f9711bd4c9e4885/documents/static/src/views/kanban/documents_kanban_renderer.xml#L6)

After this commit:
- Only the events bound to the specific HTMLElements are now triggered.
- We successfully prevent the un-necessary call of the `onGlobalClick`
method mentioned above.

Refer the related enterprise PR for the test case of this fix.

Task-3489455

closes odoo/odoo#150257

X-original-commit: e321fe3a40dd470095c79e7abcd273d6fa0cfe7c
Related: odoo/enterprise#54752
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2024-01-23 18:27:45 +00:00
Achraf c096cccb4d [FIX] web: usable *_activity widget in many2many subview
Example of steps:
	- Install `web_studio`
	- add a `many2many` field from res.partner
	- create a record
	- add a line by selecting a partner

In this case `_parseServerValue` will crash

https://github.com/odoo/odoo/blob/29d55e44035b6e6c6aba6fa4a114d555a766b7c7/addons/web/static/src/legacy/js/views/abstract_model.js#L101-L111

Because `field.selection` is undefined
this code is getting field from this line

https://github.com/odoo/odoo/blob/d3ef5891e8e92636dd61b8f2b7186ad139e8b42a/addons/mail/static/src/web/fields/kanban_activity/kanban_activity.js#L14
Instead of specifying `selection: []` in the fieldDependencies
this pr fixes this issue generally and prevents these kind
of fixes https://github.com/odoo/odoo/pull/125052

opw-3671417

closes odoo/odoo#150445

X-original-commit: 139e107a58ff4be4f03a57df07806355cb7d6236
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2024-01-23 07:07:53 +00:00
Simon Genin (ges) e4dda761ed [FIX] web: kanban column quick create validates on enter
When creating a new column in kanban view, the user should be able to
either hit enter or click the add button. This launched the validation
process to add the column.

There has been a fix in owl that would force a t-model.trim to be lazy.
This was causing problems in this case as the "enter" pressed by the
user was detected through the hotkey system. This was causing the
change event not to fire, resulting in the behavior of the feature being
broken.

We fix this by using the t-on-keydown directive instead of the hotkey.
We also remove the t-model directive as it is no longer of any use.
The trim is done in the validate function.

task id 3691208

closes odoo/odoo#150297

X-original-commit: e3ad26632b00d0b0dded25282e4dc910983ef9dc
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2024-01-23 04:41:41 +00:00
Lucas Perais 3ba89c75be [FIX] web: report: remove CSSCustomProperties in bg and text colors
After the migration to Bootstrap5 (odoo/odoo#95450), some standard
bootstrap classes did not work anymore when *printing* the report
via wkhtmltopdf (bg-dark, bg-black etc.....).
This is because wkhtmltopdf doesn't support CSS Custom Properties and many
Bootstrap5 rules use them (many have already been adapted in the referenced PR or linked ones)
wkhtmltopdf doesn"t support rgba CSS function either.

This fix allows for thoses classes to work when printing as they can be used
if the report was edited via Studio's Report Editor.

closes odoo/odoo#150214

X-original-commit: 9e32609e6920485d690b3bdb1e4dc83b338c8b36
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2024-01-22 15:56:56 +00:00
Julien Mougenot 0fc7b3e999 [FIX] web: give enough space to display datepicker on small screens
Before this commit, the datepicker was not displayed entirely on small
screens if the current view wasn't tall enough.

This commit adds a margin (supposedly) big enough to render the entire
picker even on small screens.

Task 3585878

closes odoo/odoo#149510

X-original-commit: 47c0627d218bd846596c9deb84720fc289047365
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2024-01-22 13:02:17 +00:00
Antoine (ande) 701f3a3fcc [FIX] web: report not good when exporting to pdf
Steps to reproduce:
1. Go to Settings
2. In Document Layout
3. Click on Configure Document Layout
4. Preview looks right
5. Click on Download PDF Preview
6. Open the PDF
7. Preview is not right
8. The bottom right table is squished

Cause of the issue:
Introduced by https://github.com/odoo/odoo/commit/778cc239010f3bb8618824fdaf06cb19922d6498

Fix:
Copied report_invoice_document

opw-3651311

closes odoo/odoo#150195

X-original-commit: 227c9567845ec9a592e9f265fbfcee537dd17ff5
Signed-off-by: Antoine Demany (ande) <ande@odoo.com>
2024-01-22 06:47:31 +00:00
Odoo Translation Bot 95a4b6dfdc [I18N] Update translation terms from Transifex 2024-01-21 00:17:03 +01:00
Xavier Bol (xbo) 2ddc00f9af [FIX] web: display "Remove Cover Image" button
Before this commit, when a kanban card has cover image set and the user
would like to remove it, he does not have the "Remove Cover Image"
button displayed when he goes to KanbanCoverImageDialog. The reason
is because the condition on `t-if` set on that button is always
falsy because `coverId` is undefined in the component.

This commit defines getter called `hasCoverImage` to return true
if the record displayed in the kanban card has cover image set.

task-3623759

closes odoo/odoo#150033

X-original-commit: c5d1894804c590dec208755e93d21f249714721d
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-01-20 02:43:00 +00:00
mjvi-odoo db05ddcf10 [FIX] web: 'upload and Set' button not functional in project task cover image
Steps to Reproduce:

Navigate to Project.task kanban view.
- Attempt to set a cover image.
- Observe the non-functional 'upload and set' button.

Issue:
- The 'upload and set' button in the Project Task Cover Image is unable to click

Solution:
- Resolved the issue, ensuring the 'upload and set' button functions correctly
  for a seamless cover image setting in Project Task.

task-3623759

X-original-commit: fc531640dedf7c8a576ed43d8e27a0c1054ec512
Part-of: odoo/odoo#150033
2024-01-20 02:43:00 +00:00
Michael (mcm) 178e28b467 [FIX] web: batch position updates
Before this commit, a component that uses the `usePosition` hook could
trigger multiple position update in the same tick and the update would
be call as much as it was called.
In this commit, the hook batches the calls to the update to call it
once.

closes odoo/odoo#149655

Task-id: 3673493
X-original-commit: 12fbf33aca2e9efafbb94337d9c3b538779d9f6c
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2024-01-19 19:10:53 +00:00
Michael (mcm) 86d00f1053 [FIX] web: fix searchbar menu position
Before this commit, the searchbar menu was misplaced after opening the advanced search dialog.
After this commit, the searchbar menu is always at the correct position.

Task-id: 3673493
X-original-commit: 19d40f48fb98b28b7fd49b79581ac0ac5fcecc87
Part-of: odoo/odoo#149655
2024-01-19 19:10:53 +00:00
amdi-odoo f232abd716 [FIX] web: fix percentpie value rounding
Fix the rounding of the percentpie field value as it was sometimes
displaying a very long number due to python rounding precision.
The value is now displayed rounded to 2 decimals without trailing zeros.

Task-3648755

closes odoo/odoo#149226

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-19 15:21:47 +00:00
Lucas Perais e7a511b7b5 [FIX] web: nested subviews pieces do not pollute main view
Have a nested (2 levels) form view with a footer.
On the main view, add a record in the one2many in form view (dialog).

Before this commit, the footer of the nested one2many form (within the dialog) was
put inside the footer of the dialog, which is wrong, as the footer originates
from a subview, hence has nothing to do with its parent.

After this commit, each subview's part that should be rendered elsewhere than
in the main formRenderer doesn't pollute the main view.

opw-3681966

closes odoo/odoo#150010

X-original-commit: 4891753cc3ef1a6a1daa36ecd70e79e7410e9bb0
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2024-01-19 13:13:55 +00:00
luvi c1d250fcbc [FIX] web, *: show a dismiss button in the PWA notification
*: mail

This commit fixes the behavior of the notification to install the PWA.
The initial spec was not completely achieved, since the 'Dismiss' button,
using the fa-close icon was not present. See task-3275275.

Now, the button is present, and it can hide the notification and the user don't
need to interact with the installation prompt to dismiss it.

The fix also fixes the behavior of the notification when being used in
an incognito tab. The installPrompt service assumed the PWA could be
installed, since window.BeforeInstallPromptEvent is defined. But in an
incognito scenario, the event was never actually triggered, since the
feature is disabled by the browser.

This could finally create a UX issue if the app had been installed, and the
localStorage cleaned. The notification would appear, but wouldn't do anything
when clicking on the Install button since the event is no longer triggered by
the browser. Now, we rely on the trigger of the event exclusively, except on
Safari, where we rely on the installationState and the standalone display-mode.

Now, the service only set its state when the event has effectivelly been
triggered and the native prompt can be called. Since the UI relies on the
state from the service, the notification is no longer shown.

Tests have been adapted, to dispatch a custom event, allowing the service to be
initialized as if it was in a situation where the PWA can be installed effectively.
A new test have been added to verify the interaction with the close icon.

closes odoo/odoo#149961

Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2024-01-19 01:36:10 +00:00
Kartik Chavda (kcv) d89b6556d6 [FIX] web: fix record saving issue
Steps:
- Open the Project module.
- Open any project.
- Add a subtask.
- Without manually saving the subtask beforehand, click on 'View'.
Form view of sub-task opens that doesn't have any of the fields it should
inherit from its parent task.
- Go back to the parent task using the breadcrumbs.
- Click on 'View' again. Now, the sub-task has all of its fields set as it should.

Issue:

- After clicking on 'View', the form view of the sub-task opens, but it doesn't
have any of the fields it should inherit from its parent task.

Cause:

- On clicking 'View', the switchToForm action is called, and this action
doesn't save records before switching to the form view. Also, it should load
that record into the Parent task after saving. In other modules, when clicking
on 'View', the openRecord action is called,  which is also not saving data.

Fix:

- Records should be saved when the action is called on clicking 'View'.
For the project module, when the action is called, after saving the record,
it should also load records in the parent task.

task-3631285

closes odoo/odoo#147665

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-18 20:16:01 +00:00
Prakash Prajapati 72c26c8c30 [FIX] web: fix color-list in the Dark Mode
Step:
 - install planning module
 - active the Dark Mode
 - open planning model
 - create shift with material resource
 - check the material resource icon

Issue:
   when dark mode active that time background and color are not proper show

Fix:
   We have fixed according the tag_list.

task-3524295

closes odoo/odoo#138391

Related: odoo/enterprise#54510
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2024-01-18 05:12:44 +00:00
Jorge Pinna Puissant 04a894c936 [FIX] web: kanban progressbar update aggregates compute
When clicking on a filter on a progress bar of a group, the aggregates
need to be recomputed. To do this, a web_read_group is called.
Since [1], the key groupDomain was removed, with the result that, the
web_read_group is called for all the groups and not only for the needed
one. This can be a performance issue.

Now, the key groupDomain was reintroduced and the web_read_group is done
only for the modified filter's group.

[1]: https://github.com/odoo/odoo/commit/8723f020c3587a900c811b8cc23f53fe34b98df3

closes odoo/odoo#149695

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-18 01:34:15 +00:00
mano-odoo e0491c1a62 [FIX] web, mail: increase form view width
Currently the form sheet have a flex-grow-1, the chatter could use less
horizontal space to leave more space for the form sheet's content.

This commit widen the form_sheet by applying a flex-grow-2 and
reduces the chatter's top bar total width by removing the icons and
applying a sup tag on the micro information displayed aside the icons.

Since the icons are removed there is no need to test if the icon is
rendered with it's appropriate text anymore thus we can remove these
two lines. Additionally the `text-warning` on the span was unnecessary
since it's already applied on the button parent. 

task-3641988

closes odoo/odoo#147136

Related: odoo/enterprise#53208
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2024-01-16 22:39:58 +00:00
Mathieu Duckerts-Antoine 3abba287f7 [FIX] web: adapt editFavoriteName helper
With the last realease of owl, .trim now implies .lazy. This means that
if t-model.trim is used, the value will be updated in the state only when
the change event is triggered. Here we adapt the helper editFavoriteName
which was supposed to update the state value.

X-original-commit: 7a16b75a35a5bd60190ee5b437b925a2fa99fb70
Part-of: odoo/odoo#149507
2024-01-16 13:15:22 +00:00
Mathieu Duckerts-Antoine 2f934bc91f [IMP] web: update owl to 2.2.9
We update owl to 2.2.9. Our version was 2.2.7.

Release notes:
https://github.com/odoo/owl/releases/tag/v2.2.8
https://github.com/odoo/owl/releases/tag/v2.2.9

These releases contain small improvements
2.2.8:
    - [IMP] template set config: getTemplate function
    - [IMP] parser: .trim modifier implies .lazy modifier
    - [REF] parser, template_set: factor out parseXML function
2.2.9:
    - [IMP] reactivity: replace sets with small arrays for performance

X-original-commit: 91a1f495b260ab23df80d74faeae25a5883deda0
Part-of: odoo/odoo#149507
2024-01-16 13:15:22 +00:00
miad-odoo 2d5d178403 [FIX] web: fix invoice preview
Before this commit, the `report_invoice_wizard_preview` was rendered well in
html and in the preview (settings page) but not when downloading it ; the
"total" table was pushed all the way to the right.

opw-3648586

closes odoo/odoo#149509

X-original-commit: 232c257c1554f2f47b589a971cdf9f98227ef53c
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Adrien Milis (miad) <miad@odoo.com>
2024-01-16 11:40:03 +00:00
Brieuc-brd 0ef9d5b272 [FIX] web, *: adapt oi-close and corner arrow icons
*: mail, pos_sale, pos_self_order, website_sale

=== `oi-close` adaptation ===
Prior to this commit, `oi-close` icon was based on the default
sans-serif font. Depending on this, there could be alignment and size
inconsistencies with the Odoo UI icon library.

This commit adapts `oi-close` to use a custom icon from the UI icon
library to make it more robust and maintain consistency with this
library.

=== corner arrow icons adaptation ===
Prior to this commit, directional icons related to the four corners were
misaligned.

This commit adapts these four icons so that they are properly aligned.

task-3618046

closes odoo/odoo#144598

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-16 09:55:22 +00:00
Kartik Chavda (kcv) 82c962c665 [FIX] web: set max width on filter and groupby menu
Steps:
- Install planning app.
- Open Planning.
- Click on search bar menu.

Issue:
- The groupBy column width is more than expected.

Cause:
- groupBy and filter menu size changes depending on their
groupBys and filters names so giving bigger name to filters
and groupBy increase their size and there was no max-width
set on then and because of setting name and giving bigger
string on field makes that column unexpectly big.

Fix:
- set max-width on `o_filter_menu` and `o_group_by_menu` to
avoid unexpected bigger size for filter and groupby columns.

task-3607270

closes odoo/odoo#140412

Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2024-01-16 08:23:10 +00:00
bve-odoo 72c1a4f96a [IMP] *: replace type where possible
do not compare types, for exact checks use `is` / `is not`,
for instance checks use `isinstance()`Flake8(E721)

Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2023-11-07 17:09:34 +00:00
Pierre Paridans 9d920ee859 [FIX] web: control panel create button shouldn't be shown in dialog
The kanban's create button ("New") is usually displayed in the
ControlPanel. But in the select/create dialog (like many2one dialog),
the create button is moved to the footer.

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

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

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

opw-3431221

closes odoo/odoo#149329

X-original-commit: c21c600189b36b7b4b352f8017467c8ef7d07c87
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2024-01-14 18:05:05 +00:00
Odoo Translation Bot b81790505b [I18N] Update translation terms from Transifex 2024-01-14 00:16:26 +01:00
Jorge Pinna Puissant f468bba9d5 [FIX] web: fix error when no app in clickbot
Since [1], an error is raised when no app is detected on the clickbot.
The issue with this is that it's possible for a user to no have access
to any app. This occurs when we test single apps (web for instance) with
demo user.

The aim of the error is to detect if we are stuck on a tablet mode page.

Now, we change the test on the ensureHomeMenu function, to don't have
false positives, and detect correctly if we are stuck on a tablet mode
page.

Fixes runbot issue 52675
opw-3649047

[1] : 8f365824c9dddacf1b3a40688a30c8498df3d5d4

closes odoo/odoo#149214

X-original-commit: 10475a96401b02b95e92cc6c9eaa909aeb7de1d1
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-12 14:27:48 +00:00
Samuel Degueldre 8f1f32d0fb [FIX] web: improve ListRenderer rendering speed
The ListRenderer disables the checkbox of all lines corresponding to a
record which cannot be selected. Unfortunately, because
`canSelectRecord` is a getter, it is invoked once per line, and this
getter in turns invokes the `editedRecord` getter which scans all record
to find which record is selected. This operation is O(n²), so it's very
slow when there are a lot of records.

This commit fixes that by computing the value once per render.

Time to render the list view of views (technical > User Interface >
views) with 600 records visible:
- before: ~1800ms
- after: ~250ms

closes odoo/odoo#149051

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-11 17:00:54 +00:00
Hubert Van De Walle e660cd94a8 [FIX] web: no_quick_create option ignored
Steps to reproduce
==================

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

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

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

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

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

Solution
========

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

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

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

-----

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

opw-3609799

closes odoo/odoo#148163

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

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

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

opw-3667395

closes odoo/odoo#148887

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

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

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

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

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

task-3627697

closes odoo/odoo#148925

X-original-commit: 1f2ab6d5dda61a6aad6e0e9bd282195cdd990f15
Related: odoo/enterprise#54074
Signed-off-by: Romain Estievenart (res) <res@odoo.com>
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2024-01-11 10:06:41 +00:00
mano-odoo a66fe99800 [FIX] web: kanbancard reestablish 16.0 outline effect
Since milk redesign the kanbancard lost their outline bottom on focus
state.

Previous fixes where applied to solve this issue in commit[1]
and commit[2]. These fixes were a Catch-22:
fixing a behavior here, creating an issue there (double borders,
issue on drag..) which lead to more custom code.

In this commit, we remove the code added by the previous fixes and apply
a solution used in version 16.0 and prior. Relying on a negative margin
to hide the border of the following `kanban_record` and applying an
outline effect and a greater `z-index` on focus to make it appear on
top of the border. This z-index is set to 2 to compensate the
`z-index-1` on the kanban column when a card is focused and dragged.

[1]: odoo/odoo@d8fcc218bc
[2]: odoo/odoo@2495bfa725

task-3580229

closes odoo/odoo#148869

X-original-commit: ca388322327379e470e76f3a3c6ee2b2271e3895
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2024-01-11 10:06:38 +00:00
Simon Genin (ges) 2b9717400a [FIX] web: Kanban grouped on field with readonly expression
As a reminder, the readonly expression in grouped kanban can enable or
disable the drag and drop feature. If the view is not reaonly but the
field in the arch on which the view is grouped is readonly, the drag
would be disabled.

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

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

Task id 3611116

closes odoo/odoo#148533

Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2024-01-10 19:39:26 +00:00
Louis (wil) 13bb9c21ab [FIX] *: remove escaped newlines from translated strings
The parser of the library we use to extract strings to be translated
(python-babel) doesn't handle escaped newlines in the same way as the
JavaScript parser. The resulting mismatch makes the content that uses
them untranslatable.

for example:
```js
const hey = _t("slt \
çv ?"
);
```
is exported as "slt \nçv ?", while the content of the variable is
"slt çv?"

This commit removes faulty occurrences from the code base and re-exports
the corresponding POT files.

*: point_of_sale, pos_sale, project, web

closes odoo/odoo#145971

Related: odoo/enterprise#52617
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2024-01-10 15:26:01 +00:00
Lucas Lefèvre (lul) 8a459f1859 [FIX] web: support False for selection in domain selector
The original issue (in saas-16.4) has been fixed in 17.0
by refactorings.

This commit only fw-ports the test

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

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

opw 3670344

closes odoo/odoo#148727

X-original-commit: cfdc9c6d62050e3aac4bf18f374e4772ce18a504
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2024-01-10 10:28:16 +00:00
Pierre Rousseau 62cbb20739 [FIX] web: update jsconfig paths
The jsconfig.json file is used by editors to provide autocompletion
but the paths were not updated when it's used in the enterprise
path.

closes odoo/odoo#148725

X-original-commit: c41824c35f26708bece94a6bb507496a259172c0
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2024-01-10 10:28:15 +00:00
FrancoisGe 9118bcb0c6 [FIX] web: Input Field always display the correct value
Before this commit, a Field using the useInputField hook can ignore values
from an onchange in some cases.

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

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

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

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

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

closes odoo/odoo#148711

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2024-01-10 10:28:13 +00:00