Commit Graph
588 Commits
Author SHA1 Message Date
Aaron Bohy 42ee5c346c [FIX] web: debug menu: can get view
Since commit [1], there was a crash when the user clicked on the
"Get View" item in the debug menu (in any views). This was because
the arch now received by the views in props is an XmlDocument,
whereas before it was a string.

[1] odoo/odoo@cc3a3a328d

closes odoo/odoo#137668

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-06 03:21:50 +00:00
Bruno Boi 5557853f4b [FIX] web: keep the searchbar dropdown in place
**Before this commit**
Open the SearchBarMenu dropdown, then add
numerous filters or groupbys.
When doing so the search bar may grow or shrink,
leading to the dropdown being repositioned while
you interact with it.
This gets really annoying when you are using your
mouse.

**After this commit**
The dropdown will stay in place while your
pointer is inside and get repositioned as
soon as your pointer leaves the dropdown.

**Implementation Notes**
- The usePosition hook now returns an object with functions
  that allow to lock/unlock the positioning updates.
- The "fixedPosition" usePosition's option has become
  obsolete with this new mechanism and has thus been replaced.

closes odoo/odoo#137449

X-original-commit: 3e883a2a1af07875efd7dea8de39cf9914d2a0de
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-10-06 00:55:54 +00:00
Michael (mcm) 89693faebb [FIX] web: fix http.post array params
Since [1] an error was thrown when giving multiple files to http.post.
This commit reverts changes in the function but the function now also
allows to give a FormData instead of pojo.

[1]: https://github.com/odoo/odoo/pull/136271

closes odoo/odoo#137421

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-05 15:36:19 +00:00
Jorge Pinna Puissant ef424a9dc2 [REF] *: remove owl from linter's accepted global variables
Before this commit, owl was in the linter's accepted global variables.
This allowed  direct access to owl global object.

For instance, to use xml from owl, you could do :
`const { xml } = owl;`
or you could use it directly:
`owl.xml`

Now, owl is not accepted on linter's global variables anymore, so to
import xml, now you need to use a proper import:

`import { xml } from "@odoo/owl";`

task-id 3498859

closes odoo/odoo#137517

Related: odoo/enterprise#48364
Related: odoo/design-themes#709
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-05 10:21:53 +00:00
Damien Bouvy ae62a08cbc [IMP] web: fetch raw data for record in debug
This commit introduces a new debug menu item in form view that allows to
read all the raw fields data of the current record in JSON format.

task-3509462

closes odoo/odoo#137260

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-05 08:08:58 +00:00
Saurabh Choraria 2cf99aa452 [FIX] web: groupby date for pivot view
When user tries to apply any Group By as date or datetime in the pivot
view and the column value of pivot view is also a date or dateime, the
traceback will be generated.

To reproduce the issue:
- Install Point of Sale
- Go to 'Reporting' and click on 'Orders'
- Select pivot view
- Go to Group By and select 'Order Date' same as column value
- Issue can be produce in the same way in other modules, such as - 'sale',
'sale_subscription', 'crm', 'planning', 'hr_expense' etc.

Error: TypeError: can only concatenate str (not "relativedelta") to str

The issue is occurring because we are getting duplicate values in
groupby like ['date:month', 'date:month'] while calling orm method over here -
https://github.com/odoo/odoo/blob/6cf3b617d8082df5820283d07e6623b7684cefdd/addons/web/static/src/core/orm_service.js#L143

To solve this issue groupby has been passed into a Set so that no
duplicate values occurs in groupby.

sentry-4262719543

closes odoo/odoo#137550

X-original-commit: de8e6a901b780d8c10484edae5ec1fe6b9fc7d3c
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2023-10-04 20:52:42 +00:00
Aaron Bohy cc3a3a328d [REF] web,*: simplify arch manipulation and parsing logic
*board,mail,project

This commit aims to simplify the XMLParser logic and the way archs
are manipulated in views, motivated by [1] where we had to
modify the arch in View to insert access right information.

First, the xml utils have been reworked. The XMLParser class has
been removed. The xml utils module already exported a parseXML and
a serializeXML functions, this commit adds visitXML, s.t. the whole
XMLParser feature is fully replaced by the 3 functions.

Second, concrete views now receive the arch in props as an
XMLDocument, as the arch is parsed once for all in View. With this,
we were able to remove serializing/parsing back and forth at several
places, where we needed to extract information for sub-parts of an
arch individually (e.g. View, x2many subviews, list view groupby).

Third, even though this change has been driven by the one above and
wasn't initally wanted, the view compiler cache and API have been
simplified. The cache is now flat, there's an entry in the cache for
each template that has been compiled. Moreover, the useViewCompiler
hook no longer takes the cache key in params, as it can directly
compute it itself (the key being the outerHTML of the template).

[1] odoo/odoo#135145

closes odoo/odoo#136376

Related: odoo/enterprise#47808
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-10-04 08:39:12 +00:00
Julien Mougenot eb3f18ff5e [FIX] web: patch date in object test
Before this commit, a test in the "objects" test suite failed because
it used native dates without patching them, resulting in a low chance of
the generated dates to vary by 1 millisecond and failing the assertions.

This commit patches dates in that test to avoid this issue.

RunBot task 23058

closes odoo/odoo#137426

X-original-commit: aebbbaf942b85cb4d141975a617d8bcadfe9a719
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-03 20:17:57 +00:00
Romain Estievenart 25412e1afa [IMP] web: use the height of the element as the height of placeholder
With this commit we added the ability to use the real height of the
element as the height of the placeholder when we move an item when use
the DnD like jQuery NestedSortable did.

task-3439226

Part-of: odoo/odoo#136375
2023-10-03 19:20:06 +00:00
Romain Estievenart 12821933cb [IMP] web: implement allowed drop on nested_sortable
Like the jQuery NestedSortable, we implement the function `isAllowed`.
When you use the NestedSortable hooks, you can now specify a custom
function to verify if a drop location is allowed. By default, this
function is always true

task-3439226

Part-of: odoo/odoo#136375
2023-10-03 19:20:06 +00:00
Romain Estievenart 1dff3912cb [IMP] web: add a maxLevels params for nest mode on nested_sortable hooks
Add a maxLevels param like the jQuery.nestedSortable has. The goal of
this param is to set the maximum depth of nested items the list can
accept. If set to '0' the levels are unlimited, it's the default value.

task-3439226

Part-of: odoo/odoo#136375
2023-10-03 19:20:06 +00:00
Didier (did) 7c4a8f6118 [IMP] web: improve like operators capabilities in the mock server
Before this PR, the `like` operators from the mock server could not handle
request using the `%`.
This PR introduce it.

Part-of: odoo/odoo#118794
2023-10-03 19:19:50 +00:00
Bruno Boi 00875e2654 [IMP] web: remove useless recompute position hook
This commit brings a simple improvement.
There is no need to reposition an element while
you are scrolling inside of it.

closes odoo/odoo#137139

Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-10-03 15:37:32 +00:00
Aaron Bohy 2f9c4979fa [IMP] web,survey: better error management in tests
The initial motivation of this commit was to ensure that the qunit
test suite doesn't stop when an error is thrown in a test, which
could happen if the error was thrown "sufficiently close to the
end of the test". Indeed, the "unhandledrejection" event being
async, it was sometimes triggered after the end of the test, when
the service registry was already reset, and the check of the
presence of the error service was wrong, so the error event wasn't
default prevented (e.g. await makeView(...) and the view crashes
at render time).

This led us to rework in more depth the way we deal with errors in
tests. Here are a few behaviors we want (probably not exhaustive):
 - an error in a test must never end the suite (executed in py)
 - an error in a test must always make the test fail, except if the
   error is expected in the scenario, which one must be able to
   state
 - a test must always wait for potential unhandledrejection events
   to be triggered before ending.
 - ideally, we don't want to have to deal with unhandledrejection
   in each test throwing an error (in order to prevent the suite to
   stop)

To achieve this, we come with the following solution. We introduce
a new assertion method, "expectToThrow" which allows to state that
during the test, we expect errors to be thrown. It takes a list of
error messages that will be compared at the end of the test with
the errors that have been thrown during the test. If they differ,
a qunit failure is pushed and the test fails. If an error occurs
in a test and "expectToThrow" hasn't been called, qunit is directly
informed of the error and a failing assertion is done, make the
test fail as well.

If the error service isn't available in the test environment, we
apply the logic above when an "error" or and "unhandledrejection"
event is thrown. If the error service is available, we wrap the
default handler (typically the one that handles everything that
hasn't been handled by specific handlers, like tracebacks) and if
we get to it, we apply the logic above. This means that one must
call "expectToThrow" if
 - the error service isn't deployed, or
 - the thrown error is handled by the default handler, because
   it is something like a traceback (errors like UserError,
   ValidationError are graciously handled by the RPCErrorHandler)
   and thus never reach the default handler.

In all cases, we prevent default the event such that the error
doesn't make the python test end.

Finally, to ensure that "undhandledrejection" events are handled
before the test ends, we wait, in the qunit lib, for a setTimeout
before ending the test, which ensures that all such events have
been dispatched.

closes odoo/odoo#137120

Related: odoo/enterprise#48211
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-03 06:16:46 +00:00
Julien Carion (juca) 0792200c9d [IMP] web: add include archived to domain selector
This commit introduces a new feature to the domain selector that allows
to toggle a new "include archived" option that alters the domain in a way
such that archived records are included or not. This domain part is naive
and may overlap with custom parts of the domain. The special domain part
which includes archived records (['&', <previous_domain>, '|', ('active'
, '=', True), ('active', '=', False)]) is invisible inside the domain
tree but remains visible in the domain code editor.

Also rename the "Match records with xxx of the following rules" statement
to "Match xxx of the following rules".

task-3482381

closes odoo/odoo#135861

Related: odoo/enterprise#47599
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-02 14:12:47 +00:00
Bruno Boi bf954def41 [FIX] web: close popover on pointerdown
**Preliminary note**
The fix mentioned in this commit is already done
in another commit [1].
The below commit message stayed the same for history's sake.

**Before this commit**
A popover would close on outside mousedown event.

This is not sufficient enough, has for instance all the draggable stuff
makes use of the pointer events instead of the mouse events.

This lead to some unwanted behavior, i.e.:
- Open the DomainSelectorDialog
- Open a ModelFieldSelectorPopover
- Try to drag the modal
- The popover remain open and its position is not updated.
  The dialog's dragging is fine.

**After this commit**
The popovers will close on pointerdown away events.
Now:
- Open the DomainSelectorDialog
- Open a ModelFieldSelectorPopover
- Try to drag the modal
- The popover is closed and the dragging still works as expected.

[1]: 76665eb400168a6fd6e2b5f5fe099c8c4e9c8a5e

closes odoo/odoo#137247

X-original-commit: c63dbc4ed0a04e34571c2929f43812873b62fd16
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-10-02 12:58:52 +00:00
FrancoisGe ba0205afbb [FIX] web: autocomplete inEdition
When a user is editing an Autocomplete, we don't want to delete its value
if the props value changes.

For example:
- In a form view with a many2one field and another field with an onchange
- Edit the second field
- Insert a value in the many2one input
- The onchange of the first field returns a value for the many2one

Before this commit:
    The value inserted in the many2one is lost. It is replaced by the
    onchange value

After this commit:
    The value inserted in the many2one is unchanged.

closes odoo/odoo#136654

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-28 01:51:24 +00:00
Tom De Caluwé 3de3a1903a [FIX] web: avoid undefined format in parseDate
The safeConvert function in the useDateTimePicker hook will call parseDate with
an undefined format when no format option was provided to the hook. Before this
commit, since the options object passed to parseDate still contained the format
property, the undefined format will also be passed on to the parseDateTime
function. This is problematic, because now the parser will use the default
datetime format, and it will fail because of the absence of a time value in the
input string.

For some input formats, parseDateTime will still yield the correct result using
one of its backup parsing methods. However, a wrong result will be returned for
date formats containing some textual parts (for example MMM/dd/yyyy).

Making sure no undefined format values are passed on in the parseDate function
resolves the problem.

opw-3478797

closes odoo/odoo#136221

X-original-commit: b04482ed87db05b3fc2523a08ce7ca5818af578b
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Signed-off-by: Tom De Caluwé (tdc) <tdc@odoo.com>
2023-09-25 09:38:38 +00:00
Mathieu Duckerts-Antoine 1995f21d42 [FIX] web: field service: protect async methods
The async methods of field service were not declared in its key async.
This would allow destroyed components to process the results of those
methods (despite an initial call to useService). We fix that.

closes odoo/odoo#135950

X-original-commit: 7955def19c7d4a8c49be472413423bbf3beec2e5
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-09-25 07:53:58 +00:00
abd-msyukyu-odoo 657314adb1 [IMP] web: draggable_hook_builder option to ignore selectively
The way the `ignore` property is implemented means that nested draggable
elements under a single element matching the `ignore` selector will all be
disabled.

In Knowledge, the sidebar allowing to move articles around has nested draggable
elements that the user should be able to move around, under other draggable
elements that should stay in place (depending on access rights).

Therefore, this commit introduces another way to disable dragging with the
`preventDrag` property which is a function that receives the dragging candidate
and returns a boolean to indicate whether the element can effectively be dragged
or not in its current situation.

task-3456741

closes odoo/odoo#135981

X-original-commit: eb302dbf48500b2eee61a0efb865868866fb454b
Related: odoo/enterprise#47640
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Damien Abeloos (abd) <abd@odoo.com>
2023-09-21 06:31:01 +00:00
Leonardo Pavan Rocha e6e3722dec [FIX] web: show caret in NameAndSignature
Adds a caret to the font selection in the NameAndSignature component.
Prior to this change, the font icon was hidden without the caret.

Also, the caret direction is not being correctly updated when the target
element is closed. This commit fixes this by storing the initial direction
and forcing this direction when the dropdown is closed.

task-3431069

closes odoo/odoo#135774

X-original-commit: 7d11e281fa70a853191378bee3750d12bb76f9b9
Related: odoo/enterprise#47513
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-09-18 22:17:14 +00:00
Pierre Paridans 49f649b991 [FIX] web: default DateTimePicker has wrong number of column
Following the introduction of the `showWeekNumbers` prop on
DateTimePicker component (see commit 7552284e78),
the number of column (CSS custom property) wasn't properly defined in
the template.

This commit fixes it and adds related asserts in QUnit tests.

closes odoo/odoo#135427

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-09-14 11:22:55 +00:00
Sébastien Theys 7ea370fce7 [REF] mail, *: tests: refactor contains to further remove jQuery
* = account, base_iban, bus, calendar, crm_livechat, hr, hr_holidays,
    im_livechat, mrp, project, sms, snailmail, test_mail,
    test_mail_full, web, website_livechat, website_slides

Add support in `contains` for most operations that we use in tests.
Remove return value from `contains`.
Move into `web` module.
Remove import/export chains, directly import from correct module.

closes odoo/odoo#134652

Related: odoo/enterprise#47064
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-09-14 11:22:47 +00:00
FrancoisGe 2ee329f6ca [FIX] web: close button in form view dialog discard
The goal of this commit is to ensure that the form view dialog close
button performs the same behaviour as the discard button.

To enable this, we had to add the dialogData.dismiss, which lets you add
a callBack that will only be executed when a dialog is closed because of
the "x" or the "escape" shortcut.

closes odoo/odoo#135116

Related: odoo/enterprise#47283
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-13 15:34:40 +00:00
Julien Carion (juca) 830206e894 [IMP] web: notification close delay improvement
This commit adds the functionality to refresh notifications when the user
hovers on them to reinitialize the close delay.

task-3444667

closes odoo/odoo#132713

Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-09-13 15:34:33 +00:00
Pierre Paridans 7552284e78 [REF] web: replace jQuery UI Datepicker usage in Calendar view
This commit removes the jQuery UI Datepicker usage for the sidepanel's
mini-calendar in the Calendar View and replace it by our own
DateTimePicker component.

On the visual side, the styling has been aligned to the DateTimePicker
one and takes a bit more space to allow a better readability.

It also adds two props to the DateTimePicker:
- showWeekNumbers : allow to show or hide the week numbers' column, default to true.
- daysOfWeekFormat : allow to choose between the "short" or "narrow" (1
  letter) format for the week's days column header, default to "short".

task-3439226

closes odoo/odoo#134263

Related: odoo/enterprise#47114
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-09-13 10:55:49 +00:00
Samuel Degueldre 5b61256976 [IMP] web: datetime picker support for custom invalidity/class per day
This commit allows users of the datetime picker service to pass
functions that will be called to check the validity of specific days or
that generate a class for a given day. This can be useful in some
contexts for example when you want to prevent the user from selecting
days on the weekend for certain operations, or to highlight some days
where a given product is not in stock.

closes odoo/odoo#134647

Related: odoo/enterprise#47061
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-12 17:16:20 +00:00
Pierre Paridans 915454bfaa [FIX] web: DateTimePicker focus when programmatically changing month
When passing a date out of the current as a props to the DateTimePicker
component, the chosen date is actually set but the calendar doesn't
rerender to display the corresponding month.

This commit fixes this behavior to properly focus the date's month.

closes odoo/odoo#134844

X-original-commit: 9dbb35479615f5aef7b22f21bf9f58f176874886
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-09-08 13:45:42 +00:00
Michael (mcm) 2da24f6f58 [IMP] web: remove useListener hook
This hook was deprecated for a while and it is time to remove it.

Task: 3439226
Part-of: odoo/odoo#134295
2023-09-08 11:12:39 +00:00
std-odoo 15353f06d7 [IMP] base, web: allow to group by properties
Purpose
=======
Allow to group records by their property values,
like we can do with normal fields.

Technical
=========
Because there's no foreign key, when we group by a relational property
we need to check the existence of the ids in the query (and same for
selection and tags, because we might have value of a deleted
option / tag in database).

Task-3032464

Part-of: odoo/odoo#103510
2023-09-08 09:46:56 +00:00
Aaron Bohy dc680a4429 [REF] web,*: stop using and remove legacy utils
*account,web_editor,website,website_sale,website_slides

This commit removes all legacy utils except Markup, which will be
removed in another PR. A lot of those utils were no longer used and
thus have just been removed. Those that were still used either
already existed in the wowl codebase, so usecases have been adapted
to use the new version instead. A few have been re-implemented (or
moved basically) to the wowl codebase (e.g. isEmail and humanSize).

Part of task~3439226

closes odoo/odoo#134620

Related: odoo/enterprise#47044
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-08 08:29:58 +00:00
Valentin Chevalier 054ca0a19a [IMP] web, *: Add more formatters in assets_frontend
Before this commit, formatters like `formatMonetary` and `formatFloat`
weren't loaded in the assets front-end.

This commit introduces `formatAmount` ( `formatMonetary` calls
`formatAmount` but makes some prior processing to deduce the currency
from the field) and makes `formatAmount` and `formatFloat` accessible
from any front-end application.

Note: The currencies were added in the front-end session info because
they are needed in `formatAmount`.

closes odoo/odoo#133824

Related: odoo/enterprise#46658
Signed-off-by: Valentin Chevalier <vcr@odoo.com>
2023-09-06 19:43:39 +00:00
Pierre Rousseau d946affe22 [FIX] web: correctly restore focus with ConfirmationDialog
When a dialog is closed, the focus is meant to be restored to the
previous focused element.

Before this commit, it did not work for the ConfirmationDialog when the
confirm button was clicked. This was because the focus was lost **before**
the dialog was closed (because the confirm button is disabled when
clicked), and thus the previous focused element was not in the el of the
dialog anymore, and thus the focus was not restored.

closes odoo/odoo#134456

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-06 13:25:37 +00:00
FrancoisGe 956393ab90 [FIX] web: clean input m2mTagsAvatar
Before this commit, performing a search in a Many2manyTagsAvatarFields
and selecting an element does not remove the search value from the input.

Why not?
The value passed to Autocomplete is the default ''.
As this value never changes, onWillUpdateProps is never called and cannot
empty the input.

Solution:
Use the resetOnSelect option to force the input to be reset at each select
if props.value is the default value.

closes odoo/odoo#134242

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-05 21:18:17 +00:00
FrancoisGe c0b6322e25 [IMP] web: add alwaysApply in useDebounce
The purpose of this commit is to add the alwaysApply option to useDebounced.
This option is used to force execution of the callBack if the debounced
function has been called and is still not resolved when the component is destroyed.

closes odoo/odoo#134096

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-04 17:10:09 +00:00
Adrien Schoffeniels 484570e65b [IMP] web: add tests for useNestedSortable hook
Purpose:
--------
This commit adds QUnit tests for the `useNestedSortable` hook.

This commit also fixes a few issues in the hook that were pointed out by
adding these tests, notably:
- the moves are now triggered based on the position of the top of the
dragged element instead of the position of the cursor (behavior was
unclear when moving long elements)
- when nesting is allowed, moving an element under another one that does
not have nested elements now inserts the placeholder after the element
instead of nesting it inside of it.

It also renames the `listType` parameter to `listTagName` to make its
purpose clearer, and moves the placeholder styling to a custom class so
that it can be customized more easily.

Task-3422012

Part-of: odoo/odoo#131769
2023-09-04 10:56:05 +00:00
Samuel Degueldre 910897fc97 [REF] web, *: remove tempusdominus date(time) picker lib
As tempusdominus relies on jQuery, we have written our own date(time)
picker in owl. This commit converts the remaining uses of the
tempusdominus date(time) picker and replaces them by our own.

closes odoo/odoo#133349

Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2023-09-04 09:19:08 +00:00
Samuel Degueldre 6580a435a9 [IMP] web: improve datetime picker support for time
This commit improves the support for time in the datetime picker by
doing two things:
 - allow to pick seconds by giving a rounding value of 0
 - check minDate and maxDate by accounting for the time when the picker
is in datetime mode instead of only checking the date

Part-of: odoo/odoo#133349
2023-09-04 09:19:08 +00:00
Samuel Degueldre 8faef71242 [FIX] web: fix datetime picker disabling incorrect periods
Previously, if you specified a min or max date for the datetime picker
and zoomed out to the month/year/decade view, it would disable some
months/year/decade incorrectly, this was caused by the code checking if
the beginning of the period was in the min-max range instead of checking
if the period had any overlap with the min-max range.

This commit fixes that by checking for overlaps instead.

closes odoo/odoo#133911

X-original-commit: 7cb61dca99be4b0a1c35f0ec762c1bda318ec043
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-01 15:09:57 +00:00
Aaron Bohy d4448ade44 [REF] web: remove unaccent legacy utils
This utils also exists in /core/utils/strings and the legacy
version was no longer used. Also remove the diacritics map which
is heavy.

closes odoo/odoo#133896

Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-09-01 15:09:52 +00:00
Aaron Bohy 2a121a32a2 [REF] *: rename unity_web_search_read into web_search_read
Part-of: odoo/odoo#133617
2023-08-31 09:04:58 +00:00
Aaron Bohy 986c00c1bd [REF] web,*: always use unity_web_search_read
*project,spreadsheet

The unity version of web_search_read will soon replace the older
one, so this commit prepares the work by adapting the remaining
calls to web_search_read s.t. they call unity_web_search_read
instead.

Part-of: odoo/odoo#133617
2023-08-31 09:04:58 +00:00
Aaron Bohy f065276a46 [FIX] web: tests: click helper: throw error if target is disabled
Before chrome 116, programmatic clicks on disabled buttons weren't
actually fired. With chrome 116, they are. As a consequence, some
tests fails on chrome 116 because they click (on purpose) on
disabled button to highlight the fact that nothing happens.

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

closes odoo/odoo#133196

Related: odoo/enterprise#46398
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-29 11:10:50 +00:00
Michael (mcm) 629a046e03 [IMP] web,*: empty services/core.js
This commit removes almost all exports of the module services/core.js
(only the bus is left) and adapts the module that imported it.

task 3439226

Part-of: odoo/odoo#133153
2023-08-29 11:10:47 +00:00
luvi 440c72f2aa [FIX] web: fix draggable with touch input
This commit fixes some isues with touch behaviors in the drag and
drop feature. Since commit (1), pointer events are used instead of
mouse events in the draggable hook. This makes the drag and drop
available with touch, but some issues appeared.

The following issues have been adressed by the commit:
- Scrolling in a kanban view has become difficult, since items are
dragged, and columns are moved. A simple scroll in the view to show
other items was nearly impossible without interacting with elements.
A small delay has now be introduced in the draggable_hook_builder by
default for touch interactions. The user has to do a long press (500ms)
to instanciate the drag sequence.

- on Windows laptops, the hasTouch helper would not return true, even
on PCs and tablets with a touchscreen, because 'ontouchstart' is not
present in the window object. It meant that any touch feature was not
working properly (e.g. moving icons from the home screen).
This commit adds a mediaQuery check right after the current check on
the window object, to also consider those laptops as touch devices.

Tests have been added to check the behavior of the touch drag, and the
presence of a bouncing animation when initiated. The corresponding drag
helper now has the possibility to set a custom pointerType.

task-3436591

closes odoo/odoo#132373

X-original-commit: 4c5cf0962f91d05085fea75e9c26ecdca9c0eb13
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2023-08-19 12:01:57 +02:00
Pierre Pulinckx (pipu) c07181b20b [REF] *: Replace env._t() by _t()
In this commit, all usages of env._t() are replaced by _t().
In templates files, env._t() didn't work because terms used
in attributes where not extracted into the translation files.
Only string are exported from .xml files to translation files.
So, to make it works, we set a variable that is then used
in attributes.
For example :

<t t-set="string_to_translate">String to translate</t>
<Dialog title="string_to_translate>...</Dialog>

task-3292454

closes odoo/odoo#131390

Related: odoo/enterprise#45631
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-18 19:17:16 +02:00
Gorash 0d99f4b9d9 [REF] base,all: Update modifier syntax: adapt JavaScript
closes odoo/odoo#104741

Related: odoo/enterprise#35255
Related: odoo/documentation#3523
Related: odoo/upgrade#4884
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
2023-08-18 09:49:16 +02:00
std-odoo 10110bd4e4 [IMP] web: allow to disable the popover re-position
Purpose
=======
When the DOM changes, we recompute the popover position. This is useful
for most popovers, but when we have a form inside the popover (like the
properties definition) it can be very annoying to move the form while
the user fills it.

Task-3380176

closes odoo/odoo#128983

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-08-16 08:10:49 +02:00
Jorge Pinna Puissant f30be0732e [FIX] web: renderToElement should be detached
Before this commit, the element returned by the function
renderToElement, it was still attached to the parent <div> added in the
render function.

Now, the element returned is detached.

Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:31 +02:00
Julien Carion (juca) 2a72028ce6 [FIX] web: prevent upload of large files
This commit ensures that files uploaded using the FileInput, upload
service or AttachDocumentWidget will not exceed the maximum file size of
the context in size before sending them to the server. It also moves
some utils from the formatters file to the numbers file so that one
can use them without requiring the view assets.

task-3390746

closes odoo/odoo#126914

Related: odoo/enterprise#45629
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-11 14:32:00 +02:00