Commit Graph
14142 Commits
Author SHA1 Message Date
FrancoisGe 63aaf17392 [REF] *: remove field from args pass to extractProps
This commit aims to simplify the extractProps api by removing "field".

The Field will need to go into
this.props.record.fields[this.props.fieldname] to access the information
previously stored in the "field" parameter.

Part of Task: 3179751

closes odoo/odoo#113214

Related: odoo/enterprise#37469
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-23 14:54:11 +01:00
Aaron Bohy fe7c58f027 [FIX] web: rpc_service: handle internal server errors
It may happen that the response of a json rpc isn't json parsable,
for instance when the connection pool is full (PoolError). In this
case, the response is an internal server error (500) in html.
Trying to json parse it throws an error. Commit [1], backported in
15.0 by [2] aimed at throwing a more readable and meaningful error
when this happened.

However, this error occurs frequently on the saas for the moment
(see task 3193565), and users constantly report those HTTPError
tracebacks introduced by [1].

In 14.0, we were using jQuery ajax, and the legacy rpc and error
system, where those internal server errors were handled as
connection lost errors (error code -32098). So basically, a
notification was briefly displayed instead of an error dialog.

This commit restores the previous behavior in the new rpc service.

[1] https://github.com/odoo/odoo/commit/5c4a54022b320
[2] https://github.com/odoo/odoo/commit/a01122543a79c

closes odoo/odoo#113434

X-original-commit: 278686d8540a194f0af51e1a0b68b26b13eaf544
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-23 09:30:46 +01:00
std-odoo ba381f80ed [FIX] web: fix the formatting of the float / integer property
Bug
===
The number property should be formatted like a normal integer / float field,
in the form view (show 2 decimal for the float, thousands separators, etc,
even when editing).

Task-3162402

closes odoo/odoo#113449

X-original-commit: 99c251820dcf4791625fabd3fcd61db84280d408
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-22 23:24:45 +01:00
Aaron Bohy f87dd9ed0d [FIX] web,mail: tooltip service: correctly apply default delay
The delay of tooltips opened with the tooltip service can be given
in xml, with attribute data-tooltip-delay. If not specified, there
is a fallback in the service to 400ms. Before this commit, the
fallback wasn't correctly applied, because we parsed the xml delay
into an integer, which was NaN when the delay wasn't specified,
and as NaN isn't undefined, the fallback wasn't applied. As a
consequence, we opened the tooltip in a setTimeout with NaN as
delay, and it thus opened directly.

closes odoo/odoo#113425

X-original-commit: 553b2775a4b31c75d1d246816b749e4521e25726
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-02-22 21:37:33 +01:00
Benoit Socias 8699831c02 [FIX] web: restore focused element highlight in website search
Since [1] the highlight of the focused element in the search
auto-complete has disappeared. This makes the keyboard navigation barely
usable.

This commit restrains the owl styling of dropdowns to the Owl Dropdown
components. This restores the highlight of the focused element on all
website dropdowns (e.g. also the logged-in user one and the "+" to
display more menu entries).
[1] did move the bootstrap's dropdown specific style customizations to
`webclient.scss`.

Steps to reproduce:
- Drop a "Search" snippet.
- Save.
- Type "a" in the search box.
- Navigate the suggestions with the keyboard up and down arrows.
=> Currently focused element looked the same as the other ones.

[1]: https://github.com/odoo/odoo/commit/84715436d87bb05b421bc9ccaacda67d07571690

task-3148871

closes odoo/odoo#113409

X-original-commit: e21ab2cb4904da9efeb7710a8bf8f6efec67821b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-02-22 20:26:09 +01:00
fdardenne e160d7b33d [FIX] web: popover service: prevent the crash when undefined target
Steps to reproduce:
- In debug mode
- Go to a cancelled invoice in Accounting
- Click to the "Reset to draft" button in a fast timing (before the
`PopoverContainer` is mounted).

When hovering an element, a tooltip appears. If the target element
disappears before the `onMounted` of the `PopoverContainer`, then the
popover causes a crash because the target element does not exists
anymore.

This fix makes the `tooltip_service` verify that the target still exists
before adding the popover.

closes odoo/odoo#113406

X-original-commit: 589acab37a4c1b68876386b752a91c3412dc4569
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Dardenne Florent (dafl) <dafl@odoo.com>
2023-02-22 20:26:04 +01:00
Jorge Pinna Puissant aed1ba484d [REF] web, * : simplify concrete fields API - remove type prop
This commit, is part of a series of commits that aim to simplifie
the concrete fields API.

In this commit we will remove type prop from concrete fields. Now each
field could directly use this.props.record.fields[this.props.name].type
if they need to know the type of field.

task-id 3179751

closes odoo/odoo#112792

Related: odoo/enterprise#37118
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-22 13:46:29 +01:00
Jorge Pinna Puissant 8cde3e84bb [REF] web, * : simplify concrete fields API - remove update prop
This commit, is part of a series of commits that aim to simplifie
the concrete fields API.

In this commit we will remove update prop from concrete fields. Now each
field will directly use this.props.record.update to make changes, and
handle the save in fields that need to (e.g. priority). As a consequence
of this, the record props need to be mandatory.

task-id 3179751

Part-of: odoo/odoo#112792
2023-02-22 13:46:19 +01:00
Loan (lse) 31bf052491 [FIX] web: JS traceback when trying to load unexisting field
To reproduce (V16):
 1. Force modify a view with an unexisting field
    For example `res.users.tree` with:
    `<field name="unexisting_field"/>`
    ( note that odoo won't allow to do so,
      you will have to do it in raw PSQL * )
 2. Open Settings > User & Companies > Users
=> JS traceback error:
```js
UncaughtPromiseError > TypeError
Uncaught Promise > Cannot read properties of undefined (reading 'string')

TypeError: Cannot read properties of undefined (reading 'string')
    at http://localhost:8069/web/assets/debug/web.assets_backend.js:67523:84 (/web/static/src/legacy/legacy_load_views.js:67)
    ...
```
* : In practice, it happens to Odoo customers after
incorrect installations/removal of apps

After this commit:
 The JS traceback is much clearer regarding the error:
 ```js
 UncaughtPromiseError
 Uncaught Promise > Missing field string information for the field 'unexisting_field' from the 'res.users' model
 ```

OPW-3071843

closes odoo/odoo#113345

X-original-commit: 33f82a60cd3bb64e67d939795b774cd332ab0508
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-22 11:42:05 +01:00
Leonardo Pavan Rocha 63208dca09 [IMP] sign: clear signature when clicking on draw
Clicking on draw in the signature dialog should clear whatever is already drawn
on the canvas.

task-3040855

closes odoo/odoo#113248

X-original-commit: f1c3d83f5b4f6ef0e2b5db2b7aa55344c91454f0
Related: odoo/enterprise#37338
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Leonardo Pavan Rocha <lpr@odoo.com>
2023-02-21 21:07:43 +01:00
Guillaume (gdi) 492aff522a [FIX] website, web: handle device visibility on table of content
By following these steps:
- Drop a block table of content on a page
- Disable the visibility of the block in desktop view

=> A traceback is displayed.
This is because for scrollspy to work properly, the elements that it
handles must be visible (no display: none). Unfortunately, we put a
display none when the block must be invisible for a certain device and
the width of the screen is the one of this device. Since it is quite
complex to prevent all the cases where the block could become invisible,
we patch the scrollspy component of bootstrap so that it has a similar
behavior as in version 4.X. (not cause an error if the navigation
element is no longer in the DOM or is no longer visible).

The error is only visible since [the migration from bootstrap 4 to
bootstrap 5] because to add the class, bootstrap 4 did it with the
JQuery addClass() function which does not cause an error if the element
on which it is called does not exist. Now, bootstrap 5 does the same
thing in pure JS with classList.add() on elements that meet the
requirements (visible) which causes an error if the element on which it
is called is not defined (this is the case before this commit because
the TOC was not visible).

[the migration from bootstrap 4 to bootstrap 5]: https://github.com/odoo/odoo/commit/c48f57ea2538ad51e00ac27d58f8e191781444f3

task-3116227
opw-3135927

X-original-commit: f2b86dda77133ed9c4f02394693e771758d18bad
Part-of: odoo/odoo#113184
2023-02-21 21:07:15 +01:00
FrancoisGe 5126c9b1d4 [REF] *: register widget descriptors instead of components
Before this commit, the widget's description was stored on the
component and this component was then registered.

Now, an object describing the widget is used on registration the same way
as it is done for views since b828cfc.
This split the component's description (props, template, ...) of
the widget's description ( component, extractProps, ...) and makes
it clearer.

We did the same thing for fields in 9f4622492c

Part of task: 3179751

closes odoo/odoo#112962

Related: odoo/enterprise#37215
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-21 15:53:06 +01:00
FrancoisGe 354d311b3c [FIX] web: click on button doesn't save
Problem:
In a list view, editing a record and then clicking an action button
on that record does not save the edited field values.

Expected behaviour:
Changes applied to the record must be saved before executing the button
action.

Solution:
The 46bd694c8a67f25470a911c1eb04e0bf2e17a5f7 commit in master solves
this problem (TaskID-3132960). We will backport it and add a test for
our use case.

How to reproduce:
- Go to a list view with one text field and one button action per record
- Edit the text field
- Click on the button action

Before this commit:
The value of the text field has been restored. We lost our modification.

After this commit:
The record has been saved.

closes odoo/odoo#113120

Taskid: 3168517
X-original-commit: 5f5040730707e62885757aa6a39345a46cda9b48
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Georis François (fge) <fge@odoo.com>
2023-02-21 11:25:42 +01:00
Aaron Bohy 952ab83c90 [FIX] web: fix sample data test failing randomly
In the sample server, we generate random float values between 0
and 100. The faulty assertion expected the value to be strictly
less than 100, however, it sometimes failed: when Math.random()
generated a value >= 0.99995, it produced 100 as float value.

Runbot error 15206

closes odoo/odoo#113181

X-original-commit: 4abfb9553559080d53bc5a8ba521eec000c56a26
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-02-20 21:23:48 +01:00
Renaud Thiry 689aa32ee3 [FIX] web: sampleserver generates __range
The sample server did not create a __range value when grouping by 'date'
This resulted in a traceback as it is expected to at least be false.

This commit computes it properly.

task-3098681

closes odoo/odoo#113163

X-original-commit: cf074f1dc01da39e75aa30e4ac21eafa29d528d9
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-20 19:25:04 +01:00
Mathieu Duckerts-Antoine 94c2db94e0 [FIX] *: adapt code related to orm service create
The previous commit has as a side effect to change the value returned by
the create method of the orm service. Here we adapt the code that uses it
and make the test pass.

Part-of: odoo/odoo#111965
2023-02-20 19:25:00 +01:00
Stefan Reisich 75434804a5 [FIX] web: orm service: create several records
Before this commit, the "create" function of the ORM service didn't
allow to pass multiple records. As a consequence, it was needed to
create records one by one calling the ORM create multiple times or call
create via the method call.
This commit allows to use the create method to create several records at
once.

Part-of: odoo/odoo#111965
2023-02-20 19:25:00 +01:00
Aaron Bohy 00e76a7da0 [FIX] web: pager: count_limit: fetch count on previous
For performance reasons, we added a feature that allows to limit
the search_count done when fetching records in list and kanban
views, to display on the right side of the pager [1][2]. However,
the page previous case wasn't correctly handled when we had a
limited count. When doing page, we need to know the total number of
records to compute the offset. Before this commit, we went to the
last page, which wasn't really the last page (because we sent a
wrong offset), which can be misleading for users. With the commit,
we force a search_count when doing page previous on the first page.

[1] 6acfad2651
[2] 699215ec9a71b8c9b6a53fe96e924a400d216729

Task 3162026

closes odoo/odoo#113134

X-original-commit: cefff0dcd5b3b1120b215e6af28d678c7ec34d52
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-02-20 14:50:47 +01:00
Aaron Bohy 07aa7b0af0 [FIX] web: pager: do not fetch count on page next
Since commit [1], we can have list or kanban view with same limit
and count_limit (to save a costly search_count), i.e. have a pager
like "1-80/80+". Before this commit, when reaching the count limit
on page next, we performed the search_count. This was fine before
as the count_limit was hardcoded to 10k, so you basically never did
page next until the limit. However, it's a issue now that the
count_limit can be specified, as in the above example, we don't
want to slow down the loading of the second page records because of
the search_count.

With this commit, we slightly increase the count limit when we
reach it, so for instance doing next when the pager shows 1-80/80+
fetches the records with args offset=80, limit=80, count_limit=160
and the pager then shows 81-160/160+. If the total number of records
is reached, we know the count and display it, for instance, after
another pager next: 161-190/190.

The same logic applies when the pager is manually edited, e.g. when
you write 1-150 in a pager showing 1-80/80+, you'll get 1-150/150+
if there are more than 150 records.

[1] 699215ec9a71b8c9b6a53fe96e924a400d216729

Task 3162026

X-original-commit: d39559274e6de6cdba6972775f9bda8bd2de8fa6
Part-of: odoo/odoo#113134
2023-02-20 14:50:46 +01:00
Pierre Paridans d4a9881e03 [FIX] web: translation tests fixed for Chrome 110+
This commit adapts the translation tests for non-English Numbering
system to rely on the month's numbers instead of names, as the goal of
those tests is to verify that the correct Numbering System has been
applied instead of this specific datetime format.

This is due to Chrome 110+ modifying/fixing month's name translation in
the Intl API, and more specifically the bengalese's test breaking since
this update.

Note: Firefox and Webkit browsers applied similar fixes in their recent
versions.

closes odoo/odoo#113121

X-original-commit: 42b679b9b71bf2b58e0f785c21ef002de6f3ca32
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-02-20 13:44:38 +01:00
luvi 4551be92c6 [FIX] web: fix select background in dark mode
This commit fixes the appearance of the select element in dark mode.
Since the background color is set with transparency, a white background
was set on the options dropdown by desktop browsers, which made the
text difficult to read. By adding a color to the options, we can fix
the appearance without the need to put a color without transparency
on the select elements.

task #3147138

closes odoo/odoo#113106

X-original-commit: 194a6506a933665cc47ca96d976a0aa304eb864c
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-02-20 11:37:34 +01:00
Julien Banken dabd7bbe31 [IMP] web: graph: restorable order, stacked & cumulative options
For the Knowledge module, we would like to allow the user to fully
customize a graph view and let the user insert the graph they see in an
article. When loading the graph view from an article, the system can not
currently restore the following settings:

- For the bar chart and the line chart: The system will not able to
  restore the "sorting order" and the "stack option" set by the user.
- For the line chart: The system will not be able to restore the
  "cumulative option" set by the user.

This commit will ensure that these options can be specified from the
context of the view. The context configuration will have a higher
precedence than the configuration stored in the metadata of the model.

When the user will open an article containing a graph view, the graph
view will automatically load the options that have been set by the user
when inserting the view. The user can thus create their own dashboards
by customizing the graphs and inserting them in an article.

task-3056268

closes odoo/odoo#112600

X-original-commit: 458bf22c7e275b7893505bb39c16073a9f63b9ca
Related: odoo/enterprise#37046
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-20 11:37:22 +01:00
Julien Banken 1d091b5f77 [FIX] web: fix inconsistencies in the standard view props definition
Currently, there are a few mistakes in the standard view props definition:
1. To check the type of each element in an array, the prop definition has
to include an "element" entry. In the standard view props definition, we
included an "elements" entry which will completely be ignored by the
schema validator of owl in debug mode.
2. The "element" entry is only used when the `type` entry of the prop
definition is `Array`. We will therefore simplify the property definition
and remove the "element" entry for the props that are not arrays.
3. The `orderBy` definition of the standard view props mismatch with the
`orderBy` definition of the `WithSearch` component and the search model.
This commit will fix that inconsistency for all those components and
update the tests and the JSDoc accordingly. It will then be possible to
set the `orderBy` value from the props of the `View` component without
getting an error in debug mode.

task-3056268

X-original-commit: 4911e6cd366eadc60923940364274b30372e1584
Part-of: odoo/odoo#112600
2023-02-20 11:37:22 +01:00
Aaron Bohy 36a7a6e317 [FIX] web: grouped kanban: only open at most 10 groups
For performance reasons, the grouped kanban view automatically
folds groups when they are to many, s.t. at most 10 groups are
open by default (because for each one of them, we must perform
a web_search_read rpc to fetch their records) [1].

However, during the convertion to owl, we broke half of this logic.
The qunit test introduced by [1] simulates a read_group that only
sets the __fold key to true in folded groups, but doesn't define it
in other groups. This test passed. But the logic in the model
didn't correctly handle the case where the __fold key was given for
all groups, even when its value was set to false. This happens for
instance in the project task kanban view.

This commit fixes the issue.

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

Task 3191948

closes odoo/odoo#113061

X-original-commit: dd71662cc994fb8716cae63944b4df9d4201dcdc
Signed-off-by: Georis François (fge) <fge@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-20 09:29:14 +01:00
FrancoisGe 2616dd6aae [FIX] web: header button FormViewDialog
Before this commit, in a form dialog view, clicking on an action button
in the header does not save the record being edited. The record is reset
in case a new record is created.

How to reproduce:
- Go to a form view with a non-editable m2m
- Click on add a line
- Click on Create
- Edit the new record
- Click on an action button (the arch must contain a <button> in the <header>)

Before this commit:
 The record is reset. All encoded data is lost.

After this commit:
 The record is created in db and we keep all the encoded data.

closes odoo/odoo#113063

Taskid: 3165983
X-original-commit: 52fdfe0b26941718bf1532e517a51de38cacfdbc
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-20 07:28:33 +01:00
Pierre Paridans ba7b9975c5 [FIX] web: regex syntax unsupported by Webkit
Positive Lookbehind regex syntax is currently not supported yet by
Webkit, and thus Safari (both on macOS and iOS) resulting into a crash
as the syntax is not recognized.

This issue affects both frontend and backend.

This commit fixes it by reimplementing the feature without using this
syntax.

closes odoo/odoo#112985

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-02-18 04:36:32 +01:00
Géry Debongnie 785e4fa812 [IMP] web: update owl from v2.0.5 to v2.0.6
This update conatins the following commit:

 - [IMP] devtools: provide access to Fiber and RootFiber
 - [FIX] props validation: do not subscribe to props keys
 - [FIX] reactivity: only show key in subscription if observed by callback
 - [FIX] components: stop rendering stale t-component when delayed

More details at: https://github.com/odoo/owl/releases/tag/v2.0.6

closes odoo/odoo#113041

X-original-commit: fd67ca5d2aaa9683ac1e4667e76fc4230d5d62c6
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-18 02:49:53 +01:00
Abdelouahab (abla) 5b4c93e387 [FIX] web : typo t-if vs if
To reproduce
=============
- on settings upload a custom background on document layout and save it
- open document layout again and try to download the image -> Traceback

Problem
=======
when calling download method we will ask server for a record with `id=false`
which gives an error

Solution
========
download button shouldn't be visible when `record.resId == false`

opw-3138230

closes odoo/odoo#113029

X-original-commit: 2e2cdee563dd645cabe2d361489d6eb17b174a33
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-18 02:49:50 +01:00
Bruno Boi 30950f83b9 [IMP] web, mass_mailing: introduce useThrottleForAnimation hook
Before this commit
Many of the usages of the "throttleForAnimation" util did not
cancel the call to the throttled function when the using
component is unmounted.

After this commit
A "useThrottleForAnimation" hook:
- is introduced
- is tested (as of the prior "useDebounced" hook which was not)
- replace the "throttleForAnimation" usages.

closes odoo/odoo#112913

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-17 12:07:25 +01:00
Bruno Boi 2eaedb4b8d [REF] web: sort by ASC order core/utils/timing
Part-of: odoo/odoo#112913
2023-02-17 12:07:25 +01:00
Bruno Boi db4ec2ba2f [REM] web, web_editor: remove throttle function
This function is deprecated as its behaviour is closer to "debounce".
Furthermore, it is not covered by any tests.

Only one usage has been found in the code base:
- the VideoSelector component from web_editor

This usage has been replaced by the "debounce" timing utility,
which is appropriate considering what the code tries to do.

Part-of: odoo/odoo#112913
2023-02-17 12:07:25 +01:00
Romeo Fragomeli dabd469c68 [REF] web: avoid async Promise
The executor function can also be an async function. However, this is
usually a mistake, for a few reasons:
* If an async executor function throws an error, the error will be lost
 and won’t cause the newly-constructed Promise to reject. This could
 make it difficult to debug and handle some errors.
* If a Promise executor function is using await, this is usually a sign
 that it is not actually necessary to use the new Promise constructor,
 or the scope of the new Promise constructor can be reduced.

Ref:
https://eslint.org/docs/latest/rules/no-async-promise-executor

Part-of: odoo/odoo#112855
2023-02-17 12:07:21 +01:00
Romeo Fragomeli 3693b9431b [IMP] web: add support for crop area for ZXingBarcodeDetector
As the lib ZXing barcode don't support scanning multiples barcodes at
once we have to find another way to match only the barcode into the
rectangle overlay.

Note:
Actually the barcode scanner have two ways to filter the barcode in the
rectangle overlay:
* native BarcodeDetector API -> we filter the barcode results by
 filtering the coordinate of the detected barcode (boundingBox)
* ZXing (lib) wrapper -> the lib scans only the cropped area from the
 source image (Camera)

Refs:
https://github.com/zxing-js/library/issues/346
https://developer.mozilla.org/en-US/docs/Web/API/BarcodeDetector/detect#return_value

Part-of: odoo/odoo#112855
2023-02-17 12:07:20 +01:00
Romeo Fragomeli f9fd098f18 [IMP] web: add "crop" overlay in barcode scanner
The commit restores a similar crop overlay like in the Odoo Android
Mobile App for the Barcode scanner.

This feature helps to scan the right barcode when the user scans a
barcode surrounded by other barcode, which before this commit a barcode
was scanned but in some cases not the good one. The commit solves the
problem by returning only the values into the rectangle overlay.

Part-of: odoo/odoo#112855
2023-02-17 12:07:20 +01:00
Romeo Fragomeli 5d211327c1 [IMP] web: ZXingBarcodeDetector support corner points
Adds to the ZXingBarcodeDetector the missing data into the return values
of detect method.

Note: ZXingBarcodeDetector is a wrapper that implements the interface of
the native BarcodeDetector

> * boundingBox: A DOMRectReadOnly, which returns the dimensions of a
> rectangle representing the extent of a detected barcode, aligned with
> the image.
> * cornerPoints: The x and y co-ordinates of the four corner points of
> the detected barcode relative to the image, starting with the top left
> and working clockwise. This may not be square due to perspective
> distortions within the image.

Ref:
https://developer.mozilla.org/en-US/docs/Web/API/BarcodeDetector

Part-of: odoo/odoo#112855
2023-02-17 12:07:20 +01:00
Romeo Fragomeli 2cf9a8a479 [REF] web: extract ZXingBarcodeDetector into dedicated file
Part-of: odoo/odoo#112855
2023-02-17 12:07:20 +01:00
Romeo Fragomeli 79a87e854c [IMP] web: upgrade ZXing.js to version v0.19.2
Part-of: odoo/odoo#112855
2023-02-17 12:07:19 +01:00
Pierre Paridans 6f700b2973 [FIX] web,purchase: no content helper position in modal on small screen
This commit fixes an issue where the "No records found" helper text is
wrongly positioned below the sample data's records (i.e. not visible)
instead of over them.

This is basically a revert of 9407383a56
due to the changes in the DOM and styling made in the meantime.

But actually we can go further and ensure we always have the ListView's
table present in the DOM. This change allows to simplify the positioning
of the helper and the implementation of the Purchase's dashboard.

Steps to reproduce:
- create a new database **without demo data**
- install "Planning" and "Sales" apps
- with a mobile-like screen size, open Planning
- switch to Gantt view
- in a cell, click/tap on the magnifier button (which is on hover...)
- the many2x view doesn't contain data
=> action helper "No records found" isn"t visible (scroll to bottom to
find it)

closes odoo/odoo#112878

X-original-commit: 766498a36b322ffe9c647616f56f3ba04cc51d96
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-02-16 17:57:00 +01:00
Mathieu Duckerts-Antoine 8780f0db25 [IMP] web: support of array_agg for integers and floats in mockReadGroup
Let us have records with values 1, 0, 77, 3 for a float field 'foo'.
read_group allows to get those values in an array with the aggregate
function array_agg:

read_group([], ["foo:array_agg", ...], []) will return

[{ __count: 4,  foo: [1, 0, 77, 3], ... }]

We now support the use of array_agg for integer and float fields in
the mock server.

closes odoo/odoo#112825

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-16 17:56:58 +01:00
Mathieu Duckerts-Antoine cdd6b74b11 [FIX] web: support of count_distinct for many2ones in mockReadGroup
mockReadGroup should not count the value false for a many2one when
aggregating a many2one field with the aggregate function count_distinct
and should always return a number. We fix that.

Part-of: odoo/odoo#112825
2023-02-16 17:56:57 +01:00
Mathieu Duckerts-Antoine 14f6ae8b5f [IMP] web: support of array_agg for many2ones in mockReadGroup
Let us have records with values false, 1, 2, 1, 1 for a many2one 'm2o'.
read_group allows to get those ids in an array with the aggregate function
array_agg:

read_group([], ["m2o:array_agg", ...], []) will return

[{ __count: 5,  m2o: [null, 1, 2, 1, 1], ... }]

We now support the use of array_agg for many2ones in the mock server.

Part-of: odoo/odoo#112825
2023-02-16 17:56:57 +01:00
Michael (mcm) 2e2e300ad7 [REF] web: simplify domain selector
This commit is a refactoring of the domain selector to simplify it.
The component DomainSelector now uses less sub components.
Consequently, the code is centralized in fewer files and more readable.

closes odoo/odoo#110978

Task: 3149707
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-02-16 17:56:48 +01:00
Michael (mcm) 9f4622492c [REF] *: register field descriptors instead of components
Before this commit, the field's description was stored on the
component and this component was then registered.

Now, an object describing the field is used on registration the same way
as it is done for views since https://github.com/odoo/odoo/commit/b828cfc72c587d0b73fcc5459695705640437671.
This split the component's description (props, template, ...) of
the field's description (displayName, supportedTypes, ...) and makes
it clearer.

closes odoo/odoo#112498

Task: 3171520
Related: odoo/enterprise#37105
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-16 14:13:32 +01:00
luvi c4b6a8445e [FIX] web: fix copying to clipboard no longer working
Since commit (1), the write/writeText were no longer correctly called,
because the browser native functions couldn't be called. Sometimes, it
raised the "Illegal invocation..." error, or could have an unexpected
behavior, preventing the value to be copied in the clipboard, which made
the button pointless.

No additional test was added, since it is difficult to test the clipboard
API programmatically, and the current test coverage is all that we can do,
without using the real clipboard object.

(1): 9cdcd1c1f7219030386d2c90205ea083eb835a13

closes odoo/odoo#112843

X-original-commit: 767922d43334a6cbccdb4be64f207813240fd314
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-16 08:02:08 +01:00
Vincent Schippefilt 05b85b085a [FIX] web: error when focus is inside a kanban card
repro steps:
1) in any kanban view that is not grouped, use the arrow key to focus the last card
2) use the up key to focus the previous card
3) use the TAB key to focus any element inside that card
4) use the down key to try to navigate to the last card -> traceback

The error comes from the fact that `focusNextCard` assumes that the
focus is exactly on the card element and not on any of its children.

closes odoo/odoo#112797

X-original-commit: 76434f4959cd0fade41ad02f790226f1a8046fea
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-15 16:03:00 +01:00
Aaron Bohy cfc5da5b30 [REF] web: remove unused legacy stuff
This commit removes the legacy CustomCheckbox and the backward
compatibility layer for the systray items. Both of them are no
longer used.

closes odoo/odoo#112718

Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-02-15 13:36:51 +01:00
luvi 49159d791e [FIX] web: fix displayed label of the SelectMenu
This commit fixes the wrong label that was displayed when options
are defined inside groups. Since displayValue was only looking for
a label on choices set using the choices props, the getter was only
returning the technical value for choices defined in groups.

A test has been modified to verify that the correct label is shown,
also on choices present inside of a group. This test previously
asserted that, but only on choices given by the choices props.

closes odoo/odoo#112766

X-original-commit: 176e61d5c25111a1e9339a0687bb526d1d430790
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-02-15 12:33:47 +01:00
FrancoisGe 365fe390fd [REF] web: remove redirect in router
The redirect function in the router exists only for the wait option.
This option is only used in one case (client action home). We have
therefore decided to remove the redirect function and to call
browser.location.assign(...) directly.

We will also remove the "wait" param for the "reload" and "home"
client actions. Because no call to "reload" needs it (1) and all calls to
"home" want it wait=True. So we will move the code that was executed
if wait=true to the "home" action client.

(1) In the POS, wait=true is used for a "reload" but this has no impact.
Wait=true was intended to wait for the server to restart before reloading
the page. In the case of the POS, there is no restart of the server, so
wait=True is useless.

closes odoo/odoo#112621

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-15 10:14:42 +01:00
Samuel Degueldre 1b1fd52148 [REF] point_of_sale, pos_restaurant: refactor draggable behaviour
Previously, the resize behaviour and the draggable behaviour were
completely separate, even though a lot of the logic for both behaviours
is common to both. This commit replaces both of these behaviours with a
hook: useMovable that lets the user drag an object around, but lets the
caller customize the behaviour on drag: when dragging a table or the
debug menu, we want to move the object around by setting its position in
its container, but when dragging a resize handle around, we want to
resize the table while keeping the handle position in the table the
same.

This commit also makes a bunch of popups non draggable as it doesn't
make sense for them to be draggable: you cannot interact with the
content behind the popup for as long as the popup is open (unlike the
debug menu), and serves no functional purpose, and may occasionally
confuse users.

closes odoo/odoo#112610

Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2023-02-15 10:14:39 +01:00
FrancoisGe b0b1b889f7 [FIX] web: KanbanView onCreate with sample data
The goal of this commit is to disable sample data mode when creating
a record using an on_create action in an empty kanban view.

How to reproduce:
- Go to an empty kanban view with an on_create and sample="1"
- Click on the create button
- Validate the creation

Before this commit:
    The kanban view is still in sample data mode.

After this commit:
    The kanban view deactivates the sample data mode.

closes odoo/odoo#112732

Taskid: 3176939
X-original-commit: b5909daaa16466321a0ad85aaf013155c0bcf5b2
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-15 08:07:41 +01:00