Commit Graph
2695 Commits
Author SHA1 Message Date
Mathieu Duckerts-Antoine 01d7f98e24 [IMP] web: search: domain evaluation uses action context
It is now possible to get access to the action context keys when the
search filters are evaluated. This means that a search arch filter like

    <filter name="my_filter" domain="[('my_field', '=', context.get("my_value))]"/>

can be safely evaluated if "my_value" is in the action context (or in
the user context or is builtin as before).

closes odoo/odoo#91959

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-05-20 21:09:00 +02:00
Pierre Paridans 90e65f9762 [FIX] web: <details> visiblity check regression in Chromium 97+
Since Chromium 97, folded `<details>` content has non-zero computed
width and height which returns false-positive QUnit
`assert.isNotVisible()` calls.

In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950
when Chromium implemented the ability for "Find in page" to search in folded
`<details>`. To do so, the `content-visibility` rule was used instead of
`display: none` which, even if functionally similar, has an impact on the
values returned by `getBoundingClientRect()` (i.e. used in
`assert.isNotVisible()`.

A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028
to highlight this change of behavior. What emerged from this report's
discussion is that Chromium has no intent to revert this change and
instead put the emphasis on avoiding to use `getBoundingClientRect()`
and similar methods for visibility check (even pushing a proposal for a
`Element.isVisible()` API; cf. https://github.com/w3c/csswg-drafts/issues/6850).

This commit works around this issue by forcing the content to `display:
none`, like in the previous Chromium versions.

closes odoo/odoo#91833

X-original-commit: b718e7eb5ceb827f59ac395577408b7bc54aa3f9
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-05-19 19:04:59 +02:00
Hubert Van de Walle (huvw) a478a9e906 [FIX] web: boolean_toggle widget ignores readonly attribute
The boolean_toggle should only be disabled when there is a readonly
modifier, not when the view is in readonly mode.

Cause of the issue

  The input was disabled but the `_onClick` was registered on the
  widget root node.

Solution

  - Listen for clicks on the input element
  - Override the render method to set the disabled prop according to the
    readonly modifier.

opw-2739468

closes odoo/odoo#91601

X-original-commit: 29a2402153dc95414dad8c833487e7dd18c8a222
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2022-05-19 11:13:51 +02:00
Leonardo Pavan Rocha 3bec61a95b [IMP] calendar: improve day/year/month/year view selection
Instead of having 4 buttons to select a view in calendar, we start using a
dropdown button with the framework data-hotkey approach.

task-2704432

closes odoo/odoo#81705

Related: odoo/enterprise#23131
Signed-off-by: Arnaud Joset <arj@odoo.com>
2022-05-18 19:31:20 +02:00
stefanorigano (SRI) 782047917f [FIX] web: cp's search menu-items, highlight design
As result of [1], control panel's search menu-items were highlighted
correctly on ':hover', but not using a keyboard.

This commit assigns the default <Dropdown> 'focus' class on both
circumstances.

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

task#2852217

closes odoo/odoo#91206

Related: odoo/enterprise#27355
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-05-16 17:32:56 +02:00
Laurent Stukkens (LTU) 1a8389858a [FIX] web: prevent access error in calendar
Prior to this commit:

- If the color attribute is set on a field on which the user might
  not have access to the model / record, a traceback is returned. However,
  in the case of a M2O, the name_get would be returned, so its is
  a pity that the color raise an access error.

After this commit:

- A search_read is made instead of a read, which returns nothing if
  the user does not have access to the model / record and does not raise
  a traceback.

closes odoo/odoo#91147

X-original-commit: 3e8744418d629a62e9eacd16dfa4721921e02453
Related: odoo/enterprise#27318
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-05-16 10:09:28 +02:00
tsm-odoo c23f85903a [IMP] mail, *: use pyEnv in the mockServer
Now that pyEnv is available, using it in the mock_server lighten the syntax.

task-2582313

closes odoo/odoo#90783

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-05-13 11:59:58 +02:00
3cd87ca0dc [IMP] knowledge: add the template and file commands
This commit adds some commands that can be used in the html editor.

Editor Commands
---------------

Some new editor commands have been added:

- */article:*
This command is available on every html field using the Odoo Editor.
This command allows to add a direct link to the selected knowledge article.

- */file:*
This command is only available in the Knowledge App.
This command allows to add a file (or an image) download button inside the
body. The user can choose a file to add from its own file directory or an
existing attachment already present in the database.

- */template:*
This command is only available in the Knowledge App.
This command allows the user to create a block where them can write and lay out
content destined to be reused by the readers of the article. The lasts will be
able to copy and paste it to send it as message or use it as a description on
other records.
No /command can be added inside a template.

Technical notes:
/file and /template commands can be activated in other modules by adding
knowledge_commands = True on the html field in the view where they should
be activated.

Task-2674460

Part-of: odoo/odoo#82315
Co-authored-by: Damien Abeloos <abd@odoo.com>
Co-authored-by: Julien Banken <jbn@odoo.com>
Co-authored-by: David Beguin <dbe@odoo.com>
Co-authored-by: Fabio Barbero <faba@odoo.com>
Co-authored-by: Thibault Delavallee <tde@odoo.com>
Co-authored-by: Aurelien Warnong <awa@odoo.com>
2022-05-13 02:58:51 +02:00
Bruno Boi 551f894b03 [FIX] web: conflicting accesskey/data-hotkey attrs
Issue:
Sometime an element with an [accesskey] attribute could be triggered
through the standard mechanism (accesskeys) instead of the hotkey
service mechanism (elements with [data-hotkey] attributes).

Steps to reproduce:
- open a record on a form view with a pager
- open some dialog (without using the keyboard)
- use ALT+N => the pager behind the dialog switch to the next record

This comes from the browser default mechanism for elements with an
[accesskey] attribute.

The hotkey service should have taken over on this standard behavior but
it did not because of the dialog which became the UI active element.

NB: this occurs only on a certain set of browser/OS combination. See the
following table https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/accesskey#try_it

Before this commit:
The hotkey service would take over the accesskey standard behavior ONLY
inside the UI active element.

After this commit:
The hotkey service will always take over the accesskey standard
behavior, disregarding the UI active element.

closes odoo/odoo#91261

X-original-commit: 582963a6a18ea3a2e8d3e050af4978067bfe21e1
Signed-off-by: Bruno Boi <boi@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-05-12 20:18:58 +02:00
Adesh Jolhe (adjo) 1bd3bce8df [FIX] web: fix the color_picker widget alignment issue
Currently, when we go to the planning > config > resource
(editable list view without any record) and create a ersaource
the color picker widget is resized vertically instead of horizontally.

In this commit we have fixed the issue, when there is no record in
the planning_resources list view, the color_picker widget gets 72px width by
default, so we have added a condition that if there is a color_picker widget
in a field, we will calculate the width based on the total fields in the view.

task-2720976

X-original-commit: d047080c18ea4c9314df5f2aefdfb6b7deeef45a
Part-of: odoo/odoo#90897
2022-05-09 17:05:55 +02:00
Prakash Prajapati 53992eb6ea [FIX] web_enterprise: close the burger menu on the new dialog
When the wizard (new dialog) is opened on the burger menu item, the burger menu does
not close. The burger menu appears on the wizard. It is fixed.

Reproduction Steps
  -Installed project application
  -Reporting -> Burndown Chart

task-2739646

closes odoo/odoo#90721

X-original-commit: 69821a67ca04d9aa5bb040d93e491c7f75b67232
Related: odoo/enterprise#27027
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-05-06 14:26:59 +02:00
Géry Debongnie c7cefee9cf [IMP] web: introduce macro system
This commit introduce a macro system, to allow code to automate user
actions.  For now, this is useful for the knowledge application. But in
general, this may be used by any code that want to interact "as a user"
with the web client. For example, we may consider rewriting the tour
system using macros.

Sample macros:

```js
const testMacro = {
    name: "test_macro",
    onStep: (el, step) => {
        console.log("macro step activated", el, step);
    },
    timeout: 5000,
    steps: [
        {
            trigger: '.dropdown-toggle[title="Home Menu"]',
            action: "click",
        },
        {
            trigger: ".wrong-selector",
            action: "click",
        },
    ],
};

const testMacro2 = {
    name: "test_macro2",
    interval: 1000,
    steps: [
        {
            // Open contact application
            trigger: '.dropdown-toggle[title="Home Menu"]',
            action: "click",
        },
        {
            trigger: '.dropdown-item:contains("Contacts")',
            action: "click",
        },
        {
            // click on create button
            trigger: () => document.querySelector('button[title="Create record"]'),
            action: "click",
        },
        {
            action: () => console.log("we are here..."),
        },
        {
            // input name
            trigger: 'div[name="name"] input',
            action: "text",
            value: "Aaron B.",
        },
        {
            // save
            trigger: 'button[title="Save record"]',
            action: "click",
        },
    ],
};

/**
 * Infinite macro! This also illustrates that macros can be used to do non
 * linear sequence of steps.
 */

const testMacro3 = {
    name: "test_macro3",
    steps: [
        {
            // Open contact application
            trigger: "button.o_form_button_cancel",
            action: "click",
        },
        {
            action: () => activateMacro(testMacro3),
        },
    ],
};

const testMacro4 = {
    name: "test_macro4",
    onError: (error, step, index) => {
        console.log(`an error occured at step ${index}`);
        console.log(step, error);
    },
    steps: [
        {
            // Open contact application
            trigger: '.dropdown-toggle[title="Home Menu"]',
            action: "click",
        },
        {
            action: () => {
                throw new Error("boom");
            },
        },
    ],
};

```

closes odoo/odoo#88994

Related: odoo/enterprise#27010
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-05-06 13:29:57 +02:00
Géry Debongnie 9e1bdd7912 [IMP] web: improve test helpers to mock timeouts
Part-of: odoo/odoo#88994
2022-05-06 13:29:57 +02:00
Bruno Boi f53f88a78d [FIX] web: allow hotkeys for editable elements
Since 43463a1 it was not possible anymore to trigger hotkeys
from an editable element excepted through
the hotkey option "bypassEditableProtection".
But there are cases where the editable element may want to always
allow any hotkey: e.g. the command palette search input.

Before This Commit
Impossible to trigger hotkeys from the command palette.

After This Commit
The command palette search input now allows any hotkeys.

closes odoo/odoo#90578

X-original-commit: 72dfe16ec8453ff299c2525431db619ccfdbfdec
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Bruno Boi <boi@odoo.com>
2022-05-05 15:14:59 +02:00
Bruno Boi 8be7cbd9df [REF] web: eslint issue in patchDate function
the patchDate function had these issues:
./addons/web/static/tests/helpers/utils.js
  29:5   error  Read-only global 'Date' should not be modified  no-global-assign
  58:21  error  'date' is already defined                       no-redeclare

Part-of: odoo/odoo#90578
2022-05-05 15:14:58 +02:00
tsm-odoo c77c49881b [FIX] web: remove unnecessary parameter in mocked method
The recordId parameter was not necessary in the _updateComodelRelationalFields method
of the legacy mock_server

closes odoo/odoo#90497

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-05-05 12:59:21 +02:00
Bruno Boi b7d6a56203 [FIX] web: close dropdown on capture outside click
Before this commit
An open dropdown stays opened if any other element stop a click event

closes odoo/odoo#90363

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-05-05 12:59:15 +02:00
Lucas Perais (lpe) 53fc6ea691 [FIX] web: owlCompatibility: standaloneAdapter can trigger DOM events
Before this commit, when spawning a LegacyWidget with the standaloneAdapter,
the legacyWidget couldn't re-trigger an OdooEvent (trigger_up) in the DOM
forbidding any attempts to, for instance, execute an action button (a stat button in form view)

After this commit, not only standaloneAdapter takes an optional owl ref to trigger onto
(defaults to document.body), but the last resort legacy_provider handles execute-action
DOM event.

closes odoo/odoo#90172

X-original-commit: 616d0761a8e15dfe49db9bacdfa6f7df75587dff
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-05-04 09:02:04 +02:00
Julien Mougenot 88aada39e9 [FIX] web: Datepicker uses static date format
The current datepicker implementation uses Luxon to send and receive
dates from the client and Moment to create and communicate with the
bootstrap datepicker.

Before this commit: the current database date/time format was used to
convert dates from one system to the other. However there are
inconsistencies in notation for some formats, for which the conversion
could not be made properly.

Now: a static format is used to translate dates and the actual database
format is applied only after both systems have been notified of a date
change.

Tasks 2794506, 2797949

closes odoo/odoo#90422

X-original-commit: 174bc1dfa7b2894f35c288373f5130ec2992a8e8
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-05-04 08:07:00 +02:00
Samuel Degueldre 8603d13d19 [FIX] web, test_assetsbundle: make useAssets work in owl 2
Previously, the useAssets hook would load the templates from the given
bundles into the qweb instance that was in the environment. In owl 2,
qweb is no longer in the environment, and templates need to be loaded in
the app.

This commit fixes that by exporting a function to load templates in the
main app from assets.js, when the main app is created, it should be
written on the function in a similar vein to renderToString, so that all
further calls to the function will load the templates in that app.

This commit also adds an actual lazy-loading test in the
test_assetsbundle module, as we don't want to pollute the manifest of
web with bundles that only exist for one specific test.

closes odoo/odoo#90122

Related: odoo/enterprise#26776
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-05-03 11:20:52 +02:00
Samuel Degueldre 7cffe5271d [FIX] web: fix debounce utility function when used with immediate
Previously, the "debounce" util function was broken when passing
immediate=true, this was caused by the fact that the timeout was not set
to null after being executed, leading the function to always act as
though a call is already scheduled.

This commit basically rewrites the entire debounce function to fix this
problem, simplify the code, and make the API of debounce as close as
possible to underscorejs' debounce utility (with the exception that our
debounce function returns a Promise that gets resolved if and when the
call eventually goes through, and with the extra feature that the
debounced function has a cancel method to cancel the currently scheduled
call)

closes odoo/odoo#90297

X-original-commit: 24c39ba1744d83ef9712ef4d3df7db5baf35bc2e
Related: odoo/enterprise#26821
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-05-03 05:48:03 +02:00
Géry Debongnie b828cfc72c [REF] web, *: improve the way views are defined, reintroduce controllers
Earlier in Odoo, JS views were defined by defining 4 elements: View,
Controller, Model, Renderer.  This was complex in some way, because we
wanted to inherit behaviour as well, so it was necessary to think along
multiple dimensions to understand how the code was running.

Then, with Owl, we rewrote some views, and simplified them: views were
now just a Component. Most of the common behaviour now came from the
generic View component that instantiated the concrete view with the
proper informations.  In practice, views were still split in views
(which was the equivalent of the Controller of earlier views), Model and
Renderer

Now, this commit reintroduce the Controller, and change the way views
are defined: by an object with multiple metadata, and an (optional)
props function to compute the actual props used by the view.

As a result, views are now much easier to extend/modify.

closes odoo/odoo#89889

Related: odoo/enterprise#26728
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-05-02 22:38:02 +02:00
Aaron Bohy 65d2fa48b7 [FIX] web: action service: no crash if can't stringify action
When a doAction is done, the action service stringifies the given
action and writes it in the session storage, s.t. it can be
restored on F5 even if it's a dynamic action (i.e. not in DB).

However, the stringify operation may crash (e.g. if there is a
cycle in the action description). As we do not control what is
given to doAction, it can happen, and we have to properly handle
it.

This commit simply catches the error, and there's nothing more to
do in this case.

Part-of: odoo/odoo#90271
2022-05-02 19:47:07 +02:00
Achraf (abz) 2d651e665c [FIX] web: Remove offset only for datetime field, not date
Since https://github.com/odoo/odoo/pull/87584

with `date` field, pressing enter will removes 1 day to the value.
To fix it we have to ignore the offset suppression used for `datetime`

opw-2818927

closes odoo/odoo#90115

X-original-commit: 46e6475708c7ba8289345c4f7c125f60fc77d08c
Signed-off-by: Achraf <abz@odoo.com>
2022-04-29 13:13:30 +02:00
tsm-odoo 0c83ada7de [IMP] web: move mock relational field tests
Since those tests are related to the legacy mockServer, they have been
moved to the legacy folder.

task-2582313

closes odoo/odoo#89883

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-04-29 11:01:29 +02:00
Aaron Bohy 30d2d2e7dc [FIX] web: py_js: add "true"/"false" in context
Before this commit, py_js was unabled to evaluate expressions
containing "true" or "false" (boolean values, JS syntax), which
seems reasonnable for a python interpreter. However in Odoo, we
often use that syntax in modifiers (e.g. required="true"). For
that reason, we need to add those two keywords in the evaluation
context.

Part-of: odoo/odoo#87522
2022-04-29 09:57:46 +02:00
Aaron Bohy 0c30f9e378 [IMP] web: utils: add array intersection
Part-of: odoo/odoo#87522
2022-04-29 09:57:45 +02:00
Aaron Bohy 45119056ee [REF] web: tests: makeView: let View do the "get_views"
Before this commit, the makeView test helper processed the given
arch and generated the fields to pass to the View component. This
led us to do a similar work as what is done in the view service,
i.e. duplicate code, or factorize/reuse code.

An alternative is to let the View component fetch whatever it needs
(view arch, fields, search view...). This is the purpose of this
commit. That way, the code of the view service is executed (and
thus tested as well) in each test doing a "makeView".

This commit makes that change, and adapts some tests accordingly
(mainly, tests doing assertions in mockRPC, since we do a get_view
in every test).

Part-of: odoo/odoo#87522
2022-04-29 09:57:45 +02:00
Aaron Bohy f573e93bb2 [REF] web,mail: adapt code to new load_views API
Part-of: odoo/odoo#87522
2022-04-29 09:57:44 +02:00
Samuel Degueldre f36306c8ff [FIX] web: fix ComponentWrapper lifecycle on out-of-DOM updates
Previously, updating a component that was mounted out of the DOM would
rerender it and patch it. In owl 1, patched was not called when a
component was mounted outside of the document. This caused crashes when
something done in onPatched depended on something done in onMounted (as
mounted is also not called when not it the DOM, which was handled
correctly by the compatibility layer).

This commit fixes that by ignoring requests to render a component that
is not yet in the DOM as a new render will be initiated anyway when
mounting the component in the document for real.

closes odoo/odoo#89935

X-original-commit: fc6a843abe52cfee084ed476f00a12a8ba1d1669
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-04-28 09:00:54 +02:00
Lucas Perais (lpe) 6af8b7f95e [FIX] web: basic_model: applyOnChange with 2 consecutive one2many
The problem is generally due to the use of `var`, this one

https://github.com/odoo-dev/odoo/blob/58a046d2146e884d467cde827f89fa603ed98a3b/addons/web/static/src/js/views/basic/basic_model.js#L1780 followed by an asynchronous call to a function using it

We can therefore summarize the part of the `_applyOnChange` function
that interests us by

```js

for () {
  if (field. type === 'one2many' || field. type === 'many2many') {
    var list;
    ...
    //using list
    ...

    promiseFunction(list).then(function(){
      //using list
    })
  }
}
```

In the case where we have two one2many which follow each other,
this scenario occurs:
  - `list` is initially the first o2m
  - the `promiseFunction` is called with `list` (first o2m)
  - before the promise is resolved the loop continues
  - `list` is `Promise.then()` the second o2m
  - the first call to `promiseFunction` with `list` (first o2m) is done
    - we enter in `Promise.then()`
    - `list` is currently worth the value of the second o2m because
      `list` is a `var`
  - the second call to `promiseFunction` with `list` is finished
    - we enter the `Promise.then()`
    - `list` is currently worth the value of the second o2m because
      `list` is a `var`

Result: `Promise.then()` is called twice with the first o2m and never
with the second

We can see what happened with this code example:

```js
  const array = ["a", "b"];

  const asyncRead = async(value) => {
    console.log("async function arg", value)
    setTimeout(()=>{
      return Promise. resolve(value);
    }, 100)
  }

  const forFunction = () => {
    for (let i = 0; i < array.length; i++){
      var list = array[i];
      asyncRead(list).then(function (){
        console.log("then async function arg", list)
      })
    }
  }
  forFunction()
  /*
    async function arg a
    async function arg b
    then async function arg b
    then async function arg b
  */
```

While if:
  We use `let`
    by replacing `var list = array[i];` with `let list = array[i];`
  OR
  We force the use of `Promise.resolve()` argument
    by replacing `.then(function (){}` with `.then(function (list){}`

We will get:
```js
  /*
    async function arg a
    async function arg b
    then async function arg a
    then async function arg b
  */
 ```
opw-2694855

closes odoo/odoo#89160

X-original-commit: 99cb2f52e109ccf94ac8bd735cd776e84ef04260
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2022-04-25 18:15:01 +02:00
Aaron Bohy a40cbf9f04 [FIX] web: action service: do not switchView in dialogs
Have an action with target="new" and a list or kanban view as
first view. This view is displayed in a dialog. Click on a record.
Before this commit, the action service tried to switch view, but
in the action displayed in the background (since we cannot switch
view inside the dialog anyway). As a consequence, if the action in
the background was a window action with a form view, we opened that
form view, which is absolutely not what we want (different action,
different model...). And if the action in the background was a client
action, it crashed, because we can't switch view in those actions.

With this commit, we simply ignore calls to switchView when there's
a dialog opened.

opw 2791201 and 2793678

closes odoo/odoo#89539

X-original-commit: 81f8de82daa47a31e4a33478aeb537f2c9c1519c
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-04-25 11:32:09 +02:00
Aaron Bohy a097215061 [FIX] web: action service: correct breadcrumbs in dialogs
Have an action with target="new" and a list or kanban view as
first view. It is displayed in a dialog, and a there is a control
panel. Before this commit, the breadcrumbs in that control panel
contained the complete history of controllers displayed in
background, which isn't what we want. For instance, clicking on
an element of the breadcrumbs crashed. After this commit, there's
only one element in the breadcrumbs, which corresponds to the
controller displayed in the dialog.

Spotted when investigating on opw 2791201 and 2793678

X-original-commit: 9838bb3a35e8b205fe30ceb5f86dcd81d536d1d0
Part-of: odoo/odoo#89539
2022-04-25 11:32:09 +02:00
Samuel Degueldre 7c4f200b8e [IMP] web: improve core Dialog API
*: base_automation, iap, web_tour

Previously, when trying to create a custom dialog, one would need to
extend the base Dialog class and configure it directly on the class,
using separate templates for the body and footer as necessary. This is
very unidiomatic owl code, and it is much more natural to simply extend
Component, and use Dialog at the root of the template, giving it slots
and props to configure its properties and contents.

This commit changes the dialog API to work as described and adapts code
that uses it.

closes odoo/odoo#89113

Enterprise: https://github.com/odoo/enterprise/pull/26462
Related: odoo/enterprise#26462
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-04-22 16:59:47 +02:00
Adrien Widart ce3798e6ca [FIX] web: remove default_ from parent record
When having a subview for a 2many field, if an onchange is triggered for
that field, the default values of the parent are still in the request
context.

To reproduce the issue:
(Need helpdesk_repair. Use demo data)
1. Helpdesk > Configuration > Helpdesk Teams, edit "Customer Care":
    - Enable "Repairs"
2. Create a storable and tracked-by-usn product P
3. Update the on-hand quantity:
    - 1 x P with serial S
4. Helpdesk > Customer Care (Tickets), create a ticket:
    - Product: P
    - Lot/Serial number: S
5. Click on Repair and save the repair order R
6. Edit R and add a line in "Parts"

Error: on the new line, both Product and Lot/Serial fields are already
filled with values P and S, which does not make sens

On step 5, when clicking on Repair, the form views of a repair order is
loaded with a specific context:
https://github.com/odoo/enterprise/blob/deef3c967d43862edf02dbcfc461fb89b064731e/helpdesk_repair/views/helpdesk_views.xml#L31-L34

Therefore, when editing the form and trying to add a new line in Parts,
an onchange is triggered but the default values are not removed from the
context. As a result, since the model `repair.line` also has two fields
called `product_id` and `lot_id`, the default values of the parent
(`repair.order`) are used.

When computing the context of a subview, the default values of the
parent should be removed.

OPW-2752436

closes odoo/odoo#89366

X-original-commit: db7423a97fd812fe6df95296fd7a6ca18854933b
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2022-04-22 10:59:00 +02:00
Alexandre KühnandSébastien Theys d81c77234d [IMP] mail, *: tests: use mail.channel.partner for seen indicator
* = hr_holidays, im_livechat, website_livechat

Task-2810539

closes odoo/odoo#87587

Related: odoo/enterprise#25911
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
2022-04-15 15:28:49 +02:00
Alexandre Kühn 75b75fbced [FIX] mail:tests: ignore deleted records in removed record of _updateComodelRelationalFields
Part-of: odoo/odoo#87587
2022-04-15 15:28:48 +02:00
Hubert Van de Walle (huvw) b12585b754 [FIX] web: multi edit in custom groupby list view
Steps to follow

  - Go to Accounting > Accounting > Sales (account.move.line model)
  - Remove any existing group by
  - Group by Products
  - Select multiples lines of the same product
  - Try to modify the account of the select line
  -> `this.localData[value] is undefined

Cause of the issue

  When grouping by a field not in the view, `list.__data` contains the
  groupedBy field value because we fetched the group through a web_read_group

Solution

  Filter out absent fields before creating the group datapoint

opw-2784995

closes odoo/odoo#88634

X-original-commit: d65852352ee4163f7097c19ac3c4a479922f32b8
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2022-04-13 12:57:22 +02:00
Géry Debongnie d82003382f [IMP] web: update owl to last version
This owl update is significant: it introduces a change in the way
components are rendered: now, child components check if there is a
current rendering somewhere in their ancestors. If this is the case, the
rendering will be delayed.  This prevents lots of issues where a
child components may be in some kind of corrupted state after some state
changes.

closes odoo/odoo#88572

X-original-commit: 93710d082bf860d0ea576fe99db9506af9bb42b0
Related: odoo/enterprise#26135
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-04-12 17:42:08 +02:00
Samuel Degueldre aa94c0da9a [FIX] web: make sure owl-compatibility properly calls hooks in iframes
Previously, some lifecycle hooks were not called when using a
ComponentWrapper in an iframe, this is because to know whether we should
call mounted, we check whether the target/el is in the document, but
when using iframes, the document in question is not the top-level
document and so the check returns false.

This commit fixes that by checking if the elements are inside their
ownerDocument instead.

closes odoo/odoo#88435

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-04-12 15:48:52 +02:00
Michael (mcm) f6f12bea59 [FIX] web: fix x2m dialog not opening
Before this commit, clicking on a x2m field when form view is not
editable (edit=0) did not open the dialog to show the related record.

After this commit, the dialog opens when clicking in a x2m field
of a non editable form view.

closes odoo/odoo#88378

X-original-commit: 80acf449bcaf5ff3d2ba81d84efc0498bc78c533
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2022-04-11 11:02:04 +02:00
Jorge Pinna Puissant 155ec0366d [FIX] web: error when closing action Dialog
Before this commit, when closing an action Dialog ( when the action is
wowl ) an error was raised. This occurs because we use the
LegacyAdaptedActionDialog, and an old function is called.

closes odoo/odoo#88118

X-original-commit: a6e45c53642003243e8a0f498e69ffddcac6e086
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-04-07 13:23:59 +02:00
Hubert Van de Walle (huvw) f2aaba5948 [FIX] web: radio widget ignores required attribute
opw-2729810

closes odoo/odoo#87918

X-original-commit: 65f4c4f29a9c747f114eb6359d3ebb036efab9d6
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2022-04-04 18:46:54 +02:00
Achraf (abz) 4f79f80e51 [FIX] web: Prevent datetime field from changing when pressing enter
When entering a date in a datetime field, it will be in the format
`08/01/2022 00:00:00`. If we place our cursor at the end of the
entry (after the hour) and each time we press enter, the timezone
offset is applied (so if offset is +1 it does +1 hour each time)

opw-2754116

closes odoo/odoo#87655

X-original-commit: 33e8540d64bb6e21debb7da9a121b706f551ab2e
Signed-off-by: Achraf <abz@odoo.com>
2022-04-04 10:25:26 +02:00
Aaron Bohy dba9cd97ef [IMP] web: qunit: add tests counter in topbar
This commit adds an information in the topbar (thus always visible)
to indicate the number of tests that have passed, failed and the
number of tests that have been skipped.

closes odoo/odoo#87713

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-04-01 10:36:18 +02:00
Aktiv Softwareand"Aaron Bohy <aab@odoo.com>" abd8773c78 [FIX] web: action service: handle target "main"
The target "main" feature has been lost during the conversion of
the ActionManager into the action service. An action with target
"main" should always clear the breadcrumbs. This commit
re-introduces the feature.

Fixes #83865

closes odoo/odoo#87610

X-original-commit: 78ec7281ed550eb24629c1b81445b753314d292f
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: "Aaron Bohy <aab@odoo.com>"
2022-03-31 13:33:05 +02:00
Waleed Mohsen c31423a756 [FIX] web: navbar: set action id in menu href
Before this commit, the href attribute of menu elements didn't
contain the "action=xx" part but only the id of the menu.

closes odoo/odoo#87570

X-original-commit: 6b8242ee1918b784dfdb2160cca6df1c165a824b
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-03-30 16:34:04 +02:00
Hubert Van de Walle (huvw) 0097bd77e9 [FIX] web: the search bar input should be trimmed
Steps to follow

  - Go to the Sales app
  - Search for a entry with a space at the end
  -> No results are returned

The search input should be trimmed, it was in 13.0

opw-2803156

closes odoo/odoo#87529

X-original-commit: 06817417e190d64ab6b0fc6151e02b6090b1fd39
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2022-03-30 12:06:38 +02:00
luvi 90695d16df [FIX] web: fields _onClick handler triggered twice
This commit fixes a bug present in FieldEmail and
FieldPhone where the handler on the click event was
triggered twice and was not preventing the field to
turn into quick edit mode appropriately.
A test has been added for EmailField to ensure the
correct behavior

PR enterprise: odoo/enterprise#25506

closes odoo/odoo#87196

X-original-commit: 852e084c355e9be77c693b32bf1119570e4d49d0
Related: odoo/enterprise#25558
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-03-28 12:56:52 +02:00
Yolann Sabaux dd239a604a [FIX] web: display_name in analytical tag not displayed
Steps to reproduce:
- Install accounting
- Create more than 6 analytical tags
- Create an invoice
- Create a payment
- Go in Accounting>Actions>Reconciliation, tab Manal Operations
- In the field Analytical Tag, click on 'Search More' and selected 1 or multiple tags

Issue:
Void tags are displayed

Solution:
Fetch the field `display_name`

ref commit: 84f0644802865c6454014059842eb6a9d4fd40e4
opw-2734029

closes odoo/odoo#87311

X-original-commit: 936bad32cf1024570da4880ccc5375b02b30c1c2
Related: odoo/enterprise#25631
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-03-28 10:46:28 +02:00