Commit Graph
14431 Commits
Author SHA1 Message Date
Pulinckx Pierre (PIPU) 126da95642 [FIX] *: replace %d by %s when using sprintf
*: web, web_editor, payment
Before this commit, templates with %d was given to sprintf but it was not interpreted by the function
After the commit, %d are replaced by %s in templates for sprintf
Also this commit converts a last _.str.sprintf into sprintf

PR#120143

closes odoo/odoo#120143

Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2023-05-02 15:59:04 +02:00
FrancoisGe d0bb3554c1 [FIX] web: fix advanced search comparison test
This commit adds a patchDate to the "Several date filters and a comparison"
test. The patchDate will allow the date to be fixed and prevent the test
from being invalidated when the month changes in the real world.

closes odoo/odoo#120231

Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2023-05-02 11:22:17 +02:00
Géry Debongnie 425f0fc115 [IMP] web: update owl from 2.1.2 to 2.1.3
Commits:

[FIX] components: properly differentiate t-call subcomponents
[REF] devtools: Better messages forwarding
[FIX] devtools: Fix app methods patching
[DOC] Fix a code bug in the example of slots

See https://github.com/odoo/owl/releases/tag/v2.1.3

closes odoo/odoo#120196

X-original-commit: c44d944192fb583aa3fdfa43a5b175c90907525d
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-29 14:10:08 +02:00
Hubert Van de Walle (huvw) a3a1043e22 [FIX] web: use the correct inputmode for fields
Steps to reproduce
==================

- Use an IOS device
- Open a view with a float field
- Try to edit it

The virtual keyboard displayed is missing a dot, so you can only input
integers

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

For fields that should accept a float value, the inputmode attribute
should be decimal.
Also, specifically on IOS, even with the inputmode set to decimal, it
isn't possible to enter a negative value.

> decimal:
> Fractional numeric input keyboard containing the digits and decimal separator
> Devices may or may not show a minus key (-)

Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode

Solution
========

For IOS, remove the inputmode attribute so that the default keyboard
shows. For other devices, use the decimal/numeric value depending on
whether a float should be accepted.

opw-3269275

closes odoo/odoo#120129

X-original-commit: fb37550715034e7a1fbe751889cd8ea2bd6e4128
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-28 17:23:06 +02:00
FrancoisGe 91111f33ef [REF] web: dynamicInfo domain becomes a function
In commit 2ecfed335d, we made the decision
to pass the domain to the field during extracProps with a getter in dynamicInfo.
This strategy causes the domain to be evaluated for all fields using it
in their extractProps. Very often we want to evaluate the domain on
an event, for example when a m2o is clicked on. The permanent evaluation
when using the widget therefore implies an unnecessary computational cost
for the evaluation and prevents the use of field.domain as a default value,
as it may be present in readonly views which never need the domain to be evaluated.

We will therefore convert the getter domain into a function that can be
called when we need the domain to be evaluated. This allows us to avoid
unnecessary evaluations and we can use field.domain as the default value
in the dynamic.domain.

closes odoo/odoo#120061

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-28 13:33:28 +02:00
Mohit Beniwal aeb199d77f [FIX] web: prevent missing 'data' argument error while uploading empty file
DataURL returns 'data:' in Chrome for empty files which is not valid dataURLas
it expects 'data:<mimetype>;base64' . This DataURL method is used to obtain
base64 representation of the file data,. That's why the 'data' argument is
missing and error is being generated.

Steps to reproduce:
1) Open Notes and create a new Note in Chrome.
2) Add a new attachment using /image command.
3) Add an empty file.

By applying this,it will return proper format for empty file.

sentry - 3749971166

closes odoo/odoo#120060

X-original-commit: fd6b904a97e7dab6e720675d9c805ed45eacef1e
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-04-28 13:33:25 +02:00
Samuel Degueldre d11bf24dea [REF] pos*, web: make pos service start asynchronously
*: point_of_sale, pos_hr, pos_restaurant

Previously, the pos service started synchronously, but doing anything
meaningful with it needed to be done after it was "ready", meaning it
had loaded and processed the data. The reason for this is that we need
to start the services before we mount the chrome, but in the pos we want
to show the loader immediately while the data is loading. This means
that any service that depends on the pos service in a meaningful manner
has to be written in a convoluted way, where it starts as a dummy
service and then overwrites itself in the env when it's actually ready.

This commit allows to write services that depend on the pos service more
naturally, by making the pos service properly asynchronous, meaning its
dependents will only be loaded once it's actually ready. To work around
the loader issue, the loader is mounted as a separate owl appplication
with not services, this application is shown over the chrome and when
the chrome mounts, it hides the loader and destroys the loader
application after the fade-out transition.

closes odoo/odoo#119908

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-04-28 13:33:15 +02:00
Damien Bouvy 4dbab115e2 [FIX] web: less 'in your face' kanban assignation icon
The "quick assign" feature introduced in 66321f7 can be a bit too
visible and distracting - it is after all a shortcut and should probably
not add a primary-colored button on all kanban cards it's used on.

This revision makes the quick assign shortcut only appear on a card
if it's hovered (always visible on mobile though).

ask-3292053

closes odoo/odoo#120035

X-original-commit: 198a498c83e37197a963bdb18a608834808cd096
Signed-off-by: Bouvy Damien (dbo) <dbo@odoo.com>
2023-04-28 09:53:09 +02:00
Pierre Rousseau a449b05221 [FIX] web: allow to disable autosave on boolean toggle
Since https://github.com/odoo/odoo/commit/28e6b7eb83e4309c4e70974d947194bdca240865, the boolean toggle widget
trigger a save when the user clicks on it. This is a problem when the
widget is used in a form view opened from a o2m list, because the
record updated is saved immediately, even if the user clicks on the
discard button.

This commit adds a new option to disable the autosave on the boolean
toggle widget. To disable the autosave, add `autosave: false` in the
options on the field definition.

Task-id 3235962

closes odoo/odoo#120000

X-original-commit: b56e58dff3258698dbbf173bc6790a35a47131b0
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-28 07:54:26 +02:00
Laurent Smet 10c46e2e76 [FIX] web: Add minimal support to x2many for relational_model
Suppose a RelationalModel instanciating a record.
On this record, trigger an onchange adding a new line on a one2many field.
=> The values of the Command.create command is not parsed correctly.

Indeed, if your one2many contains a Date field, its value will be a string and
not a Datetime object as expected.

closes odoo/odoo#119928

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-28 07:54:23 +02:00
luvi 5e7bc4ab85 [IMP] web: improve SelectMenu usability
This commit aims to make the SelectMenu easier to use with a better
navigation system, and the ability to select a value with the enter
key.

The bottomArea slot no longer adds a div, which could allow to use
DropdownItems in this slot, and navigate fluently from other options.

Those improvements are required by task-3134491, which will replace
a select2 input with the SelectMenu instead.

Tests have been added for the navigation behavior and the selection
with the enter key.

closes odoo/odoo#119934

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-28 06:56:53 +02:00
Ayushi Gorai c51c66805d [FIX] base_import: prevent the list out of range error
When the user uploads a file the length of the list will return 1, but when
it tries to retrieve a file which is not in the list or wants to upload another
file while the process is ongoing it will throw a IndexError.

After this commit, the race condition is satisfied i.e. now the user will not
able to upload the file while the uploading is still going on.

sentry-3938949468

closes odoo/odoo#120012

X-original-commit: 482e0034e1a5882ea1e0bc4ddb56d8ef5f5a1a92
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-04-27 18:25:40 +02:00
damr 7b306edd0b [FIX] web: fix the arrow key navigation in the kanban view
Before this commit, when the user selects a kanban card with the arrows
key navigation in the project/task kanban view, the focus will be on the
first `button/a` element found in the kanban card and so it could be
something else then the classic global click (when the user clicks on
kanban card).

This commit changes the focus to first select the element containing
`oe_kanban_global_click` to click on. If no 'oe_kanban_global_click' is
found, the focus fall back on the previous priorities.

task-3254564

closes odoo/odoo#119960

X-original-commit: 53a1061724faf9797e1301f93fdd708640313fc5
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-27 16:10:44 +02:00
Bruno Boi f22961ad07 [FIX] web,*: repair root class attr
*: web + adaptations in base, fleet, hr, hr_expense, hr_recruitment,
   loyalty, lunch, mail, mass_mailing, note, project, stock, survey,
   web_tour

**Foreword**
Since d19037e141 the rootnode class attribute for form/list views was
copied two times:
- on the o_view_controller div
- and on the root node of the view renderer.

Examples:

<form class="foo">...</form>

    gives

<div class="o_view_controller o_form_view foo">
    <div class="o_control_panel">...</div>
    <div class="o_content">
        <div class="foo o_form_editable ...">...</div>
    </div>
</div>

and

<list class="foo">...</list>

    gives

<div class="o_view_controller o_list_view foo">
    <div class="o_control_panel">...</div>
    <div class="o_content">
        <div class="o_list_renderer foo ...">...</div>
    </div>
</div>

**Issue**
This could lead to confusion and also unexpected styling issues.
See this PR #119815 to read a message JS Framework team has received.
See also another a fix that had to be made for x2m fields: 980244fa8

**Introduced Changes**
- in the form compiler, the root node attributes are no more copied to
  the root div node of the compiled template the form renderer receives
- the root div node generated by the form compiler now has the
  "o_form_renderer" class, which was removed during the recent form view
  refactoring.
- the list renderer no more adds the root node class attribute to its
  "o_list_renderer" div
- the X2ManyFieldDialog has been adapted too
- since View, X2ManyField & X2ManyFieldDialog both need to compute view
  classnames derivated from the arch root node, an util has been
  introduced to avoid duplicating code
- the whole codebase has been checked and adapted.

Related: odoo/enterprise#40418
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-04-27 16:10:30 +02:00
Leonardo Pavan Rocha 232575f684 [FIX] calendar: fix attendee's status not being shown on tags list
https://github.com/odoo/odoo/pull/110188 introduced a change in the TagsList
component, making the className prop be used in the parent tag rather than the
image tag. This change makes sense as most times you want to add classes to the
root element in the component. However, in calendar, we used className to style
the image tag, to allow showing the calendar attendee status for an event. This
commit introduces the imageClass property that should be passed in the tags
prop. Therefore, tags list will now have both className and imageClass, making
it possible to style both tags.

task-3277079

closes odoo/odoo#118781

Signed-off-by: Arnaud Joset <arj@odoo.com>
2023-04-27 16:10:24 +02:00
luvi 894090914e [IMP] web, *: add supportedOptions documentation as field metadata
*: mail, mass_mailing, sms, web_editor

This commit adds a new supportedOptions attribute that can be added to any
field widget metadata object. This documentation can be used from other places
(Studio for example) by getting the field from the registry and then read
this key. This attribute can contain an array, detailing the list of available
options for the field widget.

By using an array, it can be ordered easily without having an object with keys
unalphabetically. Ordering the options can make sense, especially when two
options are tied to each other, it is easier to group them one after the other.
(eg: 'start_date' first, then 'end_date')

Each option documented is an object and has the following attributes:
- help: contains more details on the current option and its use
- name: name used in the options object from the node
- label: a label with a more explicit name than the option name
- type: the type of value that must be used as a value (string, boolean, selection, field, domain)
- choices: for options with a 'selection': can be used to know available values
  where multiple values can be chosen as the value. This must be
  an array containing the options.
- availableTypes: for options with a 'field' selection: can be used to filter the
  available fieldNames to choose as a value.
- default: the value that is used by default, when the option is not set
  in the options

task-3259617

closes odoo/odoo#118713

Related: odoo/enterprise#39847
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-27 11:21:09 +02:00
Géry Debongnie a7cd003173 [FIX] web: do not reload webclient in some cases with errors
Whenever an user updates a company or a currency, the webclient has to
reload, to properly apply these changes. It is done automatically,
immediately after the rpc has completed.

However, before this commit, it would do that always, even if the rpc
has failed (for example, if the user tried updating an invalid field),
so the user would briefly see an error window, then the browser is
immediately reloaded.

With this commit, we only reload the webclient when the rpc succeeded.

closes odoo/odoo#119730

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-27 10:13:05 +02:00
Michael (mcm)andMathieu Duckerts-Antoine a79765ed33 [IMP] web: support of properties in domain selector
Before this commit, users could not query properties
with the domain selector. Now, all the properties are
listed when selecting a properties field.

task id: 3283212

closes odoo/odoo#115270

Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
2023-04-27 04:31:00 +02:00
MerlinGuillaume ab429a4444 [FIX] web: keep datepicker open on mobile devices
On some mobile devices (eg Samsung Galaxy S22), the datepicker
immediately closes when trying to apply a custom date filter

Steps to reproduce:
1. Install Sales
2. Open Sales
3. Click on the search icon then on the filter icon
4. Click on 'Filters' and add a custom filter on field creation date
5. Click on one of the dates
6. The datepicker opens and then closes immediately

Solution:
Do not hide the datepicker when a scroll is made on mobile devices

Problem:
When opening the datepicker, the keyboard would show up, scrolling the
view which triggers the closing of the datepicker

opw-3166801

closes odoo/odoo#119682

X-original-commit: bd6ed025fae33ff3b0444d34142e1577a457b77f
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2023-04-25 21:11:05 +02:00
Michael (mcm) b45974773a [REF] *: remove dom_ready module
This commit removes the module "web.dom_ready" and
adapts the modules that imported it.
This module was used to wait for the content to be
loaded to manipulate the dom after that.
The goal is to remove async modules and simplify the
module loader in the future.

task id: 3265979

closes odoo/odoo#119158

Related: odoo/enterprise#40051
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-25 20:06:43 +02:00
Mathieu Duckerts-Antoine 959b57bcce [FIX] web: domain selector: parse -1
Before this commit, a domain of the form "[(.., .., -1)]" would be
incorrectly represented in the domain selector as .., .., undefined.
The root cause was that py_js view the sub expression -1 as the
application of the operation - to 1 and thus create an AST of type 6 for
it. The domain selector did not expect to get such an AST but did not
crash either. Here we make it extract the intended value from the AST
for -1. More complex expressions like 3-1 are still not supported.

closes odoo/odoo#119620

X-original-commit: f9604da60c6650ad46aafe08e9fad118654a149b
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-04-25 15:20:54 +02:00
Julien Carion (juca) eaacaf122d [IMP] web, *: Add autoresize hooks
This commit adds two autoresize hooks for text inputs and textareas to
make it adapt their size (width for text inputs, height for textareas)
depending on their content.
The commit therefore solves the issue of several form view task titles
being restricted to 1 line while it can be annoying if the title is too
long. The autoresizeTextarea feature was moved from TextField to the
autoresizeTextarea hook and the autoresizeInput feature was moved from
the AutoresizeInput mail component to the autoresizeInput hook.
The TextField component has a new option for disabling linebreaks.

task-3138826

closes odoo/odoo#117355

Related: odoo/enterprise#39493
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-25 14:07:15 +02:00
Joseph Caburnay 8d50daeefa [REF] point_of_sale,*: minimize the use of legacy web modules
*: l10n_fr_pos_cert,portal_rating,pos_adyen,pos_epson_printer,pos_loyalty,
   pos_mercury,pos_restaurant,pos_restaurant_adyen,pos_restaurant_stripe,
   pos_sale,pos_six,pos_stripe,web

This is part of the continuous effort of refactoring pos addons towards using
more modern modules and programming patterns (such as services). After this
commit, point_of_sale addons are now left with the use of the legacy
`web.concurrency` module because of the `MutexedDropPrevious`. It's okay to keep
it because it's relatively an independent module compared to other legacy web
module.

The following summarizes the changes in this commit.

- import `_t` from `@web/core/l10n/translation`.

- convert `PosDB` to js native class

- remove use of `format` in `TicketScreen`
  - To determine the cached orders are up-to-date, we now deserialize the dates
    coming from the server using web's `deserializeDateTime` function. Then,
    instead of initiating `cacheDate` as native js Date, we use the luxon's
    `DateTime` which is supported by the web date utility methods.
  - There is no need for the `format` function from `web.utils` legacy module.

- convert `PaymentInterface` to native class

- remove use of `web.config` module

- remove use of `web.time` module
  - use `serializeDateTime` from web.

- remove use of `web.rpc`

- remove use of `web.utils` module
  - introduce simple check for email address input
  - Replace use of `web.utils.Markup` with `@odoo/owl.markup`.
  - 'web.utils'.{round_decimals,round_precision,float_is_zero} copied to
    '@web/core/utils/numbers'.{roundDecimals,roundPrecision,floatIsZero}.
    - These helper functions are not removed from the web addon because they
      are also used from other addons that are not linked to pos.
    - `floatIsZero` is now computed by directly comparing the result of
      `roundDecimals` to zero. This works because rounding a decimal number
      which will result to zero will exactly give zero.

- remove use of `web.field_utils`
  - Replace `web.field_utils.parse.float` with
    `@web/views/fields/parsers.parseFloat`.
  - Replace `web.field_utils.format.float` with
    `@web/views/fields/formatters.formatFloat`.
  - Replace `web.field_utils.format.date` with
    `@web/core/l10n/dates.formatDate`.
  - Replace `web.field_utils.format.datetime` with
    `@web/core/l10n/dates.formatDateTime`.

- convert `PrinterMixin` and dependents to native class
  - `PrinterMixin` is converted to `BasePrinter`.
  - `Printer` is converted to `HWPrinter` (extending `BasePrinter`).
  - `EpsonPrinter` retained its name and is converted to extend `BasePrinter`.
  - Moreover, we also removed the convoluted `PrintResultGenerator`, replaced by
    simply creating object with the following signature:
    ```js
    { successful: boolean; message?: { title: string, body?: string } }
    ```

- remove use of `web.Session`

- replace use of `qweb.render`
  - We use `renderToElement` as replacement to templates that produces valid
    html.
  - Note that `renderToElement` is introduced in `@web/core/utils/render` module
    which is extracted from the original `renderToString` method.
  - For the epson printer template, we kept the xml layout and manually add
    required xml element to contruct the xml that will be sent to the epson in
    making print requests.

- use `Mutex` from `@web/core/utils/concurrency`

- remove use of `Markup` when rendering receipt info (`ticket`) in order to
  render new lines.

- Remove use of `jquery` in `htmlToImg`.

closes odoo/odoo#117231

Related: odoo/enterprise#39078
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2023-04-25 14:07:09 +02:00
Bastien Fafchamps (bafa) bacd02f91a [IMP] web: Make AceField use the CodeEditor component
Before this commit:
The AceField component used the ace library to provide the user a code
editing field

After this commit:
The AceField component is now using the CodeEditor component and the usage
of the ace editor lib is now abstracted behind the component.

closes odoo/odoo#117782

Related: odoo/enterprise#39365
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-25 12:57:45 +02:00
Bastien Fafchamps (bafa) 353a38086c [FIX] web: Fix handling of ResizeObserver errors
Before this commit:
When using the native ResizeObserver, we might get "ResizeObserver loop
limit exceeded" errors but these can ignore, see [ResizeObserver Errors](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver#observation_errors).
This error was wrongly handled and would cause another when running tests
involving the ResizeObserver.

After this commit:
The error is now properly detected and ignored when running tests.

Part-of: odoo/odoo#117782
2023-04-25 12:57:45 +02:00
Bastien Fafchamps (bafa) e4e10337d4 [MOV] web: Moved CodeEditor component from web_studio to web
This component was created as an easy way to add a code editing field
without needing a record (unlike the AceField component). It also
completely abstracts the use of the Ace Editor library.

The CodeEditor has been moved to web core as it was needed in other
places.

The name "CodeEditor" was purposely chosen to clearly state what the
component is used for and abstract the use of Ace.

Part-of: odoo/odoo#117782
2023-04-25 12:57:44 +02:00
luvi 22cc9660ed [FIX] web: fix SelectMenu object shallowEqual
With commit (1), the clear button is only displayed when a selected
value is found from the available choices. But since we used
shallowEqual to find the corresponding choice, we couldn't use objects
containing objects in its values, since a simple comparison was made
in the utility function. This was a wrong usage of the SelectMenu and
we don't want to support objects and arrays as values. The value
attribute should only be a string, and it's the parent responsability
to handle any object related to this string.

The test using an object and an array as values has been removed since
it had no purpose after the removal of this partial and wrong support.

With this fix, an assertion for the presence of the clear button has
been added instead for the import action.

(1): d760b81271

closes odoo/odoo#119298

Related: odoo/enterprise#40177
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-25 09:38:00 +02:00
Géry Debongnie 41ae9fe011 [IMP] web: update owl from 2.1.1 to 2.1.2
This release only contains a bug fix:

[FIX] t-out: does not crash when outputting null

See https://github.com/odoo/owl/releases/tag/v2.1.2 for more details.

closes odoo/odoo#119582

X-original-commit: 363f946b13c268a280a03b57ad9ba94f60feaaa5
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-25 08:35:47 +02:00
Aurélien Warnon cbdc1f8bcb [FIX] web: ensure bound function is not undefined for "checkDefinitionWriteAccess"
This commit fixes the property field tag components and sub-components by
ensuring that the ".bind" function of the component always receives a function.

As the "checkDefinitionWriteAccess" prop is optional, it could crash because
OWL would try to call ".bind" on an undefined function.

The new code will pass an empty function instead as a fallback.
(When it's not passed, it's never called, as it is in a display context and we
do not create tags, e.g: when showing the tags in a kanban view).

Task-3280847

closes odoo/odoo#119565

X-original-commit: 7d52600263bfd911156a2d94041fc522e2baff8a
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-04-25 08:35:45 +02:00
Pierre Paridans 7c94decb77 [FIX] web: non deterministic error in calendar view's mobile test
Missing `nextTick` for this `tap` (compared to other similar calls).

closes odoo/odoo#119479

X-original-commit: 7ff8c563edf1b32ecf8222399637c294b5f58e9d
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-04-24 23:49:07 +02:00
Julien Carion (juca) 761d39658e [FIX] web: Format fields with rawAttrs in kanban
This commit makes sure that fields without widget
in kanban are properly formatted using the rawAttrs.

Steps to reproduce: create a float kanban field without
widget, set the digits to anything other than default and
see if the digits attrs are applied to the field.

opw-3263583

closes odoo/odoo#119161

X-original-commit: 1e635154654efcea59fe1f8bae679fb6bac41809
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-24 16:57:46 +02:00
amdi-odoo 30d29a48fb [FIX] web: fix selection widget caret overlap
When the text in the selection is long enough to
reach the selection caret, the caret is overlapping
the text making it unreadable.

Adding a gap between the end of the text and the caret
to prevent any text overlapping.

Task-3267526

Forward-port-of: https://github.com/odoo/odoo/pull/118059
X-original-commit: 717bba692d7167dbcd651299e84432dcecf13ab4
Part-of: odoo/odoo#119099
2023-04-24 08:38:14 +02:00
Bastien (bvdn) 68508f8bae [FIX] web: fix footer button alignement in listview dialog
The footer 'selected count' button in the plan gantt view (project) wasn't aligned,
It's the case for every dialogbox where you can select many records,
simply removed a forced bottom-margin on the container

Task-3254488

closes odoo/odoo#119424

X-original-commit: 0125a3e233eeb4cf11ec7fc0ef429dabfaada05c
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2023-04-22 15:53:19 +02:00
Mathieu Duckerts-Antoine bf2cc8d7d1 [FIX] web: SampleServer: many2many in mockReadGroup
closes odoo/odoo#119350

X-original-commit: e63f8206e9658c517743966bb9e24d110fa43508
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-22 05:52:16 +02:00
Aaron Bohy e8b75e4d99 [FIX] web: multi edit list: crash after validating with ENTER
Have a multi edit list view, select several records and edit a
field represented by an input (e.g. a char field). After typing the
new value, press ENTER to validate. The confirmation dialog opens,
click on OK/Confirm to save. Before this commit, an error was
thrown afterwards, because we tried to retrieve the value from the
input, but the input doesn't exist anymore as the edited row has
already been switched back to readonly. This commit fixes the
issue.

closes odoo/odoo#119082

Related: odoo/enterprise#40012
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-21 23:46:11 +02:00
Aaron Bohy 105299eb1d [REF] web: move list specific logic about multi edit
The primary goal of this commit is to simplify the RelationalModel
API, and in particular to remove its "fieldNodes" param, which was
only necessary for a list specific usecase, which is the opening of
the ListConfirmationDialog when multi editing. We also remove the
"blockUpdate" logic from the model s.t. it remains local to the
list controller. About this logic, we fix a minor issue as we no
longer open the "No valid record to save" dialog when the mousedown
event is trigerred on "Discard" (we instead wait for the mouseup,
like already done to open the multi save confirmation dialog).

Part of task 3179751

Part-of: odoo/odoo#119082
2023-04-21 23:46:11 +02:00
FrancoisGe 1b0b0edb3f [FIX] web: Kanban move column and record
In the commit a2342f636c, we wanted to
use isFieldReadonly to find out if the groupField field was readonly or
not. Unfortunately, this function was not suitable for this use case.
IsFieldReadonly only works on a record and not on a list. It was a
mistake to move this function to the Datapoint.

In this commit, we will put IsFieldReadonly back in the Record and
not use it to know if the field of the groupField is readonly or not.
As in the past, we will consider that a field is readonly
if its modifiers.readonly is true (we cannot take into account the
expressions to be evaluated because the record is not accessible).

How to reproduce:
Go to a kanban view group on a field with an "attrs={readonly: [...]}

Before this commit:
The view will crash.

After this commit:
No errors occur.

closes odoo/odoo#119144

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-21 15:02:17 +02:00
Viktors Lipskis (vili) a216ee0bc3 [FIX] web,calendar: fix mismatched tags
This commit replaces a closing </xpath> with a </div>, and also prevents some
potential issues with class overrides for the div.

closes odoo/odoo#119196

Signed-off-by: Arnaud Joset <arj@odoo.com>
2023-04-21 10:53:06 +02:00
Mathieu Duckerts-Antoine d8e08067d4 [IMP] web: sample server: add test file
The new SampleServer class was introduced in c67b9f9907
without dedicated tests. We fix this oversight.

closes odoo/odoo#119188

X-original-commit: 693f7bd74066fa9854db4ecef751f13ec5c7e7a6
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-20 15:21:55 +02:00
Pulinckx Pierre (PIPU) 608e90e998 [REF] *: Replace underscore functions by native JS
Replace _.map(), _.flatten(), _.delay(), _.contains(), _.pluck(), _.isUndefined(), _.isEmpty(), _.isString(), _.isEqual(), _.isBoolean(), _.memoize(), _.invoke(), _.bind(), _.escape(), _.debounce(),
_.str.sprintf(), _.str.repeat(), _.str.startswith(), _.str.trim(),
_.str.escapeHTML(), _.str.escapeRegExp(), _.str.startsWith(), _.str.include()

closes odoo/odoo#118012

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2023-04-20 11:57:29 +02:00
Jorge Pinna Puissant 95c7031027 [FIX] web: kanban: read more is briefly shown when quick create
Before this commit, when quick creating a new record in a kanban view,
the "read more" button is briefly shown (flickering). This issue occurs
because, when creating a new record, we increment the number of records
in the group before adding the record to the list of displayed records.
This means that for a brief moment the number of records of the group is
bigger than the number of displayed records, therefore the "load more"
button is show.

Note that this flickering was introduced due to the following
refactoring : https://github.com/odoo/odoo/commit/067bcac53336b5f66f695b1c10b333d8c722225d

Now, we increment the number of records on the group after we added the
record to the displayed records' list.

closes odoo/odoo#119142

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-20 10:52:06 +02:00
std-odoo 8ca2de9bfc [IMP] web: allow to use favorite in Knowledge embedded view
Purpose
=======
Allow to use favorite in Knowledge embedded view.

For that purpose, we need to hook some function in the web module
(because favorites are stored in view arc and not using ir.filters
records).

Task-3251129

closes odoo/odoo#117188

Related: odoo/enterprise#39057
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-04-20 10:51:36 +02:00
Michael (mcm) 8ec2e8cf80 [REF] *: convert last odoo modules to esm
This commit converts odoo modules that haven't been converted with
commit https://github.com/odoo/odoo/pull/117305/commits/e10b45c69e72f09128e49eb46e42834b1ef515d7.
The goal is to deprecate odoo.define in favor of native module and then
simplify boot.js by removing the regexp that finds module dependencies.

task id: 3162300

closes odoo/odoo#118812

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-19 21:58:39 +02:00
Mathieu Duckerts-AntoineandMichaël Mattiello ebf646b44f [IMP] *: ModelFieldSelector improvements
We refactor the ModelFieldSelector and ModelFieldSelectorPopover
components.

We also improve a bit ModelFieldSelectorPopover:
    - on first page, the button to go back is no longer available
      (so that it is now more difficult to produce an invalid path)
    - we always start with a page presenting the model where the last
      selected field name belongs to
    - the keyboard navigation is improved
    - click on model field selector opens the popover with the focus in
      the search input (if any)
    - for relational fields in popover: the user can either click on the
      relational field (and select it) or a special button that make him
      follow the relation to the field comodel

We also refactor the hook useDynamicPlaceholder to make it use a new
component DynamicPlaceholderPopover that uses ModelFieldSelectorPopover.

Task ID: 3272798

closes odoo/odoo#117951

Related: odoo/enterprise#39673
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
2023-04-19 21:58:34 +02:00
Mathieu Duckerts-Antoine 6e4862d2ba [IMP] web: filter menu closed on advanced search
We make the filter menu close itself when the user click on its item
"Advanced Search".

Part-of: odoo/odoo#117951
2023-04-19 21:58:34 +02:00
Rémy Voet (ryv) b60cf1f977 [REF] _read_group_raw doesn't exists anymore
`_read_group_raw` has been remove in previous commit. Convert all usage.

Part-of: odoo/odoo#110737
2023-04-19 21:58:28 +02:00
Rémy Voet (ryv) 9c5554faba [FIX] web: don't create warned orderby for read_group
`read_group` cannot order on the fields that are not
aggregates in the same transaction. We get a warning for it:
`<model>: read_group order by '<field_name> ASC' ignored, cannot sort on empty columns (not grouped/aggregated)`

Fix it.

Part-of: odoo/odoo#110737
2023-04-19 21:58:26 +02:00
Julien Carion (juca) e96566e11d [FIX] web: Fix computation of aggregates in list_renderer
This commit fixes how monetary fields are handled when doing aggregates in list view:
aggregates should not be computed when all values are not in the same currency and
the currency should be displayed with the aggregate when this is not the case.

closes odoo/odoo#116556

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-19 12:13:22 +02:00
Ipsita Borisagar b2103b06f7 [FIX] base, web: allow reading property fields when no access to parent record
This commit fixes a use case where a user would not be able to access the
property field values of a record because he did not have access to that
record's parent (from the property field definition configuration).

In a concrete example:
- In the Knowledge App
- Marc Demo has access to the "Article B".
- The parent article of "Article B" is "Article A".
- Marc Demo does not have access to "Article A".
- Article B has some property fields values configured.
- If Marc Demo tries to open "Article B" -> crash

This is caused by the framework having to read the property definition from the
parent record, which we don't have access to.
A "sudo" was added to allow that use case (which is supported).

In addition, this commit also adds further checks on the web client side to
gracefully handle a special use case where the end-user could not write on the
parent record because of record rules.
(It only checked *access rules*).

To avoid making an extra RPC every time we load the record (to check if we can
write on the parent), we only make that check when the user tries to modify
(add/edit/remove) a property and show a proper error message.
(This also applies when creating new property field tags).

Task-3062064

closes odoo/odoo#118929

X-original-commit: bc538f6944461a642bac0f757ec96d7f8cc14c9a
Related: odoo/enterprise#39946
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-04-18 19:29:03 +02:00
Pulinckx Pierre (PIPU) 800223ae7c [REF] *: Replace underscore _.each() by native JS
Replaced _.each() functions (average 235 occurences)

Description of the refactoring this PR addresses:

Current behavior before PR:

There are underscore.js function enumerated above used in odoo.

Desired behavior after PR is merged:

These functions has been replaced by native javascript
prototypes/methods/functions.

TaskId : 3246238

closes odoo/odoo#118565

Signed-off-by: Georis François (fge) <fge@odoo.com>
2023-04-18 15:38:54 +02:00