Commit Graph
173 Commits
Author SHA1 Message Date
Jorge Pinna PuissantandLucas Perais e234810faa [FIX] web: SettingsPage propagate NoContentHelper slot
Before this commit, we propagate all the slots to the SettingsPage. This
could raise an issue if the default slot (propagated) has a content, for
more information see: https://github.com/odoo/owl/issues/1256

Now, to avoid this, we only propagate the slots that are used on the
SettingsPage component, ie: NoContentHelper.

closes odoo/odoo#100362

Signed-off-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Lucas Perais <lpe@odoo.com>
2022-09-16 16:20:49 +02:00
Aaron Bohy 8f58b1c768 [FIX] web: actionService: do not allow to leave invalid form
From a (e.g.) list view, click on "Create". In the form view, fill
in some fields, but leave a required field empty. Click on the
breadcrumbs to come back to the list. Before this commit, a
notification was displayed (because some required fields are
unset), but we left the form to come back to the list anyway.

The desired behavior is to stay on the form view, and display a
notification indicating that some fields are invalid.

In legacy views, we rejected promises to indicate that we couldn't
leave. This is a pattern we tried not to use anymore in new code.
Instead, we return a promise (if the method is async obviously)
which resolves to a boolean value, indicating if it works or not.
As a consequence, the action service wasn't properly dealing with
new views, as the promises they return always resolve.

This commit fixes the issue by adapting the code in the action
service.

Part-of: odoo/odoo#100050
2022-09-13 13:53:41 +02:00
Aaron Bohy 5f499d170e [FIX] web: apply default favorite even if active_id(s)
Before this commit, we didn't apply the default favorite (if any),
when there was an active_id or active_ids in the context. This was
a mistake. Note that it only impacted owl views.

closes odoo/odoo#99989

X-original-commit: 1e13e6cd073e57b3744caefc4b8f3795c35a4c10
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-12 13:49:37 +02:00
Samuel Degueldre 3db59860cb [IMP] web: display full tracebacks for error chains
Since owl now uses error chains/causes when errors happen in the owl
lifecycle, when an error happens in the owl lifecycle, the displayed
tracebacks generally only contain the stack trace of where owl called
the corresponding lifecycle hook.

This commit modifies the error service and the error utils so that now,
when completing/annotating a traceback, we also add the tracebacks
(annotated when appropriate) of the error cause chain, as it contains
valuable debugging information.

This commit also makes it so that the QUnit suite logs the source of
each test failure (which may be an error with a chained stack trace)

closes odoo/odoo#98157

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-09-12 13:48:49 +02:00
Hubert Van de Walle (huvw) 04b3a890d4 [FIX] web: duplicated breadcrumbs when discarding settings
Steps to reproduce:

  - Go to settings
  - Click on discard
-> the breadcrumbs contains twice the "Settings" entry.

This commit fixes the issue by restoring the legacy behavior in
the "Discard" button handler, that is, calling doActionButton with
the special="cancel" param. This had been changed by mistake during
the conversion of the settings form view.

To make the fix work, a slight changed has been done in the model
as well, as reloading a datapoint could lead to the creation of
a new datapoint (typically when it's a new record), so the handle
must be updated in this case.

closes odoo/odoo#99904

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-12 11:38:18 +02:00
Aaron Bohy 9e27c5ec9d [FIX] web: form: do not display sample data in x2many
Let's assume the following scenario:
 - be on a list or kanban view with sample data
 - click on "Create" (-> opens the form view)
 - in the form view, there's a kanban x2many field

Before this commit, the no content helper was displayed in the
form view, whereas it obviously should not.

The issue occurred since [1], as this commit has the unwanted
since effect to set the property `useSampleModel` to true on the
form view model, which is used in the x2many kanban renderer to
determine whether or not to display the no content helper.

This commit forces that property to `false` on views that
explicitely ask to ignore sample data.

[1] 2600d1f2ae

closes odoo/odoo#99889

Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-09-09 12:17:10 +02:00
Mathieu Duckerts-Antoine 2600d1f2ae [FIX] web: form view does not modify useSampleModel value
Go to a (OWL) list view with sample data, click "Create" to open a (OWL)
form view and go back to the list view using the breacrumbs: the sample
data has disappeared.

This is due to the fact that the form view set useSampleModel=false in
the globalState when it is left while it does not use at all sample data
mode.

Here we make it simply pass the value that it received initially.

closes odoo/odoo#99587

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-06 10:58:22 +02:00
Simon Genin (ges) feef532b41 [REF] web, stock: refactor report client code
This commit converts the report code to the new framework.

Since the module stock still has code that extends the old
"ReportClientAction", the old report code is put inside this module.
It can be then naturally removed once the module is fully converted.

closes odoo/odoo#97390

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-02 20:10:53 +02:00
Jorge Pinna Puissant 285d1c4a08 [FIX] web: SettingsFormView - highlight Element with inner html/fields
Before this commit, if a text-muted on a setting (a description of the
setting) contains fields or HTML tags, the highlight generated wrong
texts.

Now, we highlight the text in an iterative way, taking care to only
highlight the text.

closes odoo/odoo#99205

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-09-02 09:18:35 +02:00
Jorge Pinna Puissant 129bb263f0 [FIX] web: SettingsFormView - avoid searching hidden settings
When searching a text of a hidden field (for example, "gate"), the
setting itself will not be shown, but the group title, and the app
Search Header will be shown.

This issue arise because, we use an if condition with all the label of
all the fields (hidden or not) in the group (or app) to decide if the
group title or the app header will be showed.

Now, we modify this to hide (d-none) the group title or the app header
if there is not a settings below them.

Part-of: odoo/odoo#99205
2022-09-02 09:18:35 +02:00
Bruno Boi 0ae158bf43 [LINT] web
closes odoo/odoo#99295

Related: odoo/enterprise#30900
Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-08-31 18:53:51 +02:00
Aaron Bohy 545e2378ab [FIX] web: render label with empty string to preserve layout
Previously, when a label in a form arch had an empty string attribute,
we would not render it at all as it seemed useless. In practice, some
existing form arch rely on empty labels being rendered for layout
reasons, and the corresponding views are now broken.

This commit fixes that by instead rendering an empty label, just as
legacy views used to.

Part-of: odoo/odoo#98711
2022-08-25 03:11:45 +02:00
Samuel Degueldre bdabc55280 [FIX] web: fix label with empty string rendering with default label
In legacy, when you have a label with a string attribute that is empty,
that label is rendered as empty. In the new form view, when the string
attribute was empty we would fall back to the default label for that
field, which is incorrect.

This commit fixes that by not rendering labels that have an empty string
at all.

closes odoo/odoo#98237

Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-08-18 16:47:26 +02:00
Julien Mougenot 27701b5cf7 [FIX] web: update and keep view props after switching/restoring
There were 2 problems before this commit:

1. When switching view and coming back from the breadcrumbs: the
previous view props (such as the pager props) were lost;

2. When paging to the next record, switching view and coming back from
the breadcrumb, the view was reverted to the first selected record,
effectively ignoring the paging step.

This commit fixes both of these issues by keeping the controller's
props during a "restore" action, and by also updating the current
controller's props when using the pager.

closes odoo/odoo#97395

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-08-17 11:21:12 +02:00
Lucas Perais 8ff00133a5 [FIX] web: settings: label with string taken into account
Inside a res.config.settings form view have a label with a string on it placed
before the field it is linked to.
i.e.:
```
<label for="myField" string="myString" />
<field name="myField" />
````

Before this commit, the string was not taken into account to build the HTML label.

After this commit, it is.

closes odoo/odoo#98109

Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-08-16 16:28:25 +02:00
tsm-odoo 9d86827840 [IMP] bus, *: only use one mock server during tests
*: mail, web.

The pyEnv used during tests is based on the mock server to provide
server like api. This issue is that when creating multiple environments
during tests, a new mock server is created each time. This is not realistic
since in a real world scenario, multiple tabs would share a single server.
In order to make pyEnv work with multiple tabs tests (e.g. multiple env tests),
let's create a single mock server shared between js environment during a test.

task-2053917

Part-of: odoo/odoo#97975
2022-08-12 23:37:38 +02:00
Jorge Pinna Puissant 25d2654b3b [REF] web: convert field upgradeBoolean
This commit rewrites upgradeBoolean using the new framework.

closes odoo/odoo#97951

Related: odoo/enterprise#30334
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-08-12 13:13:02 +02:00
Lucas Perais b62f494c0d [FIX] web: form: click on create always opens a form in edit
Spawn a form view with a record and set its props "mode" to readonly.
Click on "Create".

Before this commit, the new record was in readonly mode.
This is never what we want, we always want a new record to open
in edit mode.

After this commit, the new record is in edit mode.

closes odoo/odoo#97451

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-08-08 16:01:04 +02:00
Géry Debongnie 130a7d9ee1 [IMP] web, web_tour: improve isVisible helper
Before this commit, the isVisible helper would most of the time work as
expected, except if an element has display: contents.  In that case, it
has no bounding box, but it may still be visible if one of its child
is visible.

This is particularly important since we want to set the display property
of all field components to "contents".

Part-of: odoo/odoo#96865
2022-08-08 12:33:11 +02:00
tsm-odoo d998c54feb [FIX] mail, bus: fix mock sendone/many crash during tests
The mock of sendone/many was relying on the bus_service. Since owl.Component.env
is changing during tests setup, the bus_service was not always defined. In order
to make this more reliable, the longpolling/poll route is now mocked, returning a
promise that can be resolved by the sendone/many methods.

closes odoo/odoo#97298

Related: odoo/enterprise#30059
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-08-05 16:35:45 +02:00
Lucas Perais 9b81ddb993 [FIX] web: settings form view: save on click on an action button
On the res.config.settings form view, click on button that will do an action
e.g. defined as some flavor of `<button type="object" name="myMethod" />`

Before this commit, this did not work as we never fully created the res.config.settings record in python
hence, when executing myMethod on the model res.config.settings, the ID was unset, pointing to no record.

After this commit, we "create" in python the transient res.config.settings record before doing anything.

closes odoo/odoo#97428

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-04 20:11:03 +02:00
Lucas Perais 6c155e1713 [FIX] web: relationalModel: basic keys supported in record context
Have an editable list view, displaying a many2many tags field. The m2m field
has a context, mentioning `active_id`. (`context="{'default_field': active_id}"`)

"basic context keys" is to be understood as the usual suspects: active_id, active_ids, current_company_id, active_model

Type something in the m2m input, and selet create and edit, in order to create a new record in a dialog form view.

Before this commit, there was a crash because active_id was not present in the evaluation context.

After this commit, the new record opens in its form view, with the right value for the field that must have a default.

closes odoo/odoo#96910

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-08-04 18:35:32 +02:00
Aaron Bohy 74586b8f4e [FIX] web: actionService: do not crash on unknown view type
In community, some actions contain view types that only exist in
enterprise (e.g. in MRP, Work Orders, there's a gantt view). Before
this commit, it crashed because the view doesn't exist. This commit
simply ignores those unknown views.

closes odoo/odoo#97369

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-08-03 13:45:20 +02:00
Romeo Fragomeli a1dbac0f9b [FIX] web: adapt checkbox and boolean_toggle for BS5
In the BS5 migration, the legacy `checkbox` and `boolean_toggle` widget
were adapted but not the OWL Component.

Also, we have tweaked the old widget and the component to have better
positioning and margins.

Note:
the CSS for the print is already done in BS5
```css
@media print {
  .form-check-input {
    color-adjust: exact;
  }
}
```

Also we change `offsetWidth` by `getBoundingClientRect().width` in
`list_renderer` to avoid inaccurate rounding in columns width's
calculation.

Lastly a `.o-checkbox` class is added to the Checkbox component for a
more universal and context independent targetting.

closes odoo/odoo#96185

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-08-01 13:26:31 +02:00
Aaron Bohy d16ff3aa7c [FIX] web: actionService: consider "dialog_size" in context
In the context of an action, one can specify the "dialog_size" key
(only useful for actions in target="new"), which impacts the size
of the dialog. Before this commit, the corresponding bootstrap
classname wasn't applied. As a result, the dialog size was always
"large". This commit fixes that issue.

closes odoo/odoo#97085

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-07-29 17:12:56 +02:00
Lucas Perais 03bd13e4c0 [FIX] web: legacy list switches view to form with the right resIds
Have a legacy list view, click on a record to open it in a new (WOWL) form view
Before this commit, the pager was wrong, as we never passed the list's current resIds
to the form.

After this commit, the pager of the wowl form view is correct.

closes odoo/odoo#96123

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-07-25 20:12:38 +02:00
Jorge Pinna PuissantandSamuel Degueldre 2c9db825c1 [REF] base,web,*: convert settings form view to owl
*hr_timesheet,point_of_sale,website

This commit moves the settings form view implementation from base
to web, and converts it to owl.

The setting's search has been improved to take into account more
elements. Before, it was possible to only search on the field's
labels. Now, we can also search on the field's description, and
the titles of setting's group.

Part-of: odoo/odoo#78221
Co-authored-by: Samuel Degueldre <sad@odoo.com>
2022-07-22 16:21:42 +02:00
Géry Debongnie b4063a1e73 [IMP] web: update owl from 2.0.0-beta-14 to 2.0.0-beta-16
Release notes:

https://github.com/odoo/owl/releases/tag/v2.0.0-beta-15
https://github.com/odoo/owl/releases/tag/v2.0.0-beta-16

Details:

- fix: lifecyle_hooks: correctly wrap errors in async code
- imp: use a custom error class for all errors thrown by owl
- fix: package.json: remove browser value
- ref: component_node: slightly simplify code
- fix: components: fix cause left unset when thrown object is not Error

Part-of: odoo/odoo#78221
2022-07-22 16:21:38 +02:00
Bruno Boi 6f6fb914b0 [FIX] web: ignore allowed company from session storage
When switching the company, if the displayed action hasn't any
identifier, the RPC will be based on the previous company.

To reproduce the issue:
(Need stock. Use demo data)
1. Inventory > Operations > Inventory Adjustments
2. Enable the column 'Company'
3. Switch the company to "My Company (Chicago)"

Error: The quants of "My Company (San Fransisco)" are listed -> this
does not respect the selected company

On step 1, when clicking on Inventory Adjustment, it loads a Server
Action that returns another action:
https://github.com/odoo/odoo/blob/68657a85eb09dd306feab91d805b8c21eb75010f/addons/stock/views/stock_quant_views.xml#L356-L364
The returned action is a Window Action built on PY-side:
https://github.com/odoo/odoo/blob/b5d16141dc48d4379452ea40e167f3b00f956c20/addons/stock/models/stock_quant.py#L283-L300
So this Window Action hasn't any identifier (there isn't any
`action=...` in the URL)

Later on, when reloading the page (because of the company switch), we
try to load the action. To do so, we first call `_getActionParams`. In
this method, we take the current state and try to extract some
information. Because there isn't any action defined on the state (as
explained in the previous paragraph), we use the `current_action` stored
in the session storage (i.e., the window action returned by the server):
https://github.com/odoo/odoo/blob/590fa18cafe2c7bbd109692f564c2175ca6d820c/addons/web/static/src/webclient/actions/action_service.js#L294-L302
And here is the issue: the stored action contains its context and this
context contains the `allowed_company_ids` key (-> with the previous
company)

As a result, when performing the search_read to get all the quants of
the view:
https://github.com/odoo/odoo/blob/f5ba34e45b66e0fccc2559bf434e255d38a0faa0/addons/web/static/src/legacy/js/views/basic/basic_model.js#L5016-L5025
And when getting the context, it leads to `_getEvalContext`
https://github.com/odoo/odoo/blob/f5ba34e45b66e0fccc2559bf434e255d38a0faa0/addons/web/static/src/legacy/js/views/basic/basic_model.js#L3716-L3728
We apply the user context (which contains the correct value for the
company) and then apply the element context (which contains the
incorrect one, as explained above)
This explains why it will display the quants of the previously-selected
company.

OPW-2871086

closes odoo/odoo#94039

closes odoo/odoo#96161

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-07-19 21:21:55 +02:00
Matthieu Stockbauer 3ae11c87e8 [IMP] mail, *: adapt bus service to wowl env.
*: bus, calendar, iap_mail, im_livechat, project, web.

In order to ease the PR introducing the websockets in Odoo, the bus service
has to be updated to be a wowl service. This PR takes care of it.

task-2053917

closes odoo/odoo#95824

Related: odoo/enterprise#29361
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-07-14 11:42:42 +02:00
Romeo Fragomeli 1fcd098af5 [REF] *: BS5: migration
Automated change made by a lot of RegEx to change all think that is
possible to automate.

https://getbootstrap.com/docs/5.1/migration

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
Romeo Fragomeli b82ba2a8fd [REF] *: BS5: Migrate modals and .btn-close for modals and alerts
- modal 'show' option doesn't exist anymore
  -> We need to call .show()

- by default, show is not the default
  -> we need to call .show() explicitly.

- generic close button for dismissing content like modals and alerts.

- BS5 modals needs `modal-dialog` class to work

- normally we need also to add `modal-content` class but as the original
XML don't have this nested level of div we don't use it, but instead
we add `pointer-events: auto` for all children `DIV` of `modal-dialog`
-> See DocumentViewer

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:18 +02:00
Romeo Fragomeli 23facbfb76 [REF] *: BS5: migrate popovers/Tooltip
* data('bs.popover') is not a jQuery data anymore
  -> fetch data from the instance instead.

* use the new class name 'popover-arrow' instead of 'arrow'

* website_forum: offset is not a number anymore
  -> Convert to string instead.

* BS5 event listener: 'focus' -> 'focusin'

* use `mouseover` event to show and `mouseout` to hide.

* disable at some point the animation to avoid remaining listener
  in the DOM.

Ref:
https://getbootstrap.com/docs/5.1/migration/#popovers

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:17 +02:00
Mathieu Duckerts-Antoine f3543be406 [FIX] web: process context.form_view_initial_mode
Before this commit, the context parameter "form_view_initial_mode" was
ignored by the form views, so that the form view would not be always
initialized in the appropriate mode.

closes odoo/odoo#95413

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-06 17:10:28 +02:00
Géry Debongnie 74965b6298 [IMP] web: delay showing loading indicator by 250ms
Before this commit, the loading indicator is shown immediately after
each network request.  But this is distracting, and may cause an
impression of slowness, since it shows that the web client is working.
However, the feedback is very useful.

So, it has been decided that we would only display the loading indicater
after a delay of 250ms. All requests shorter than that duration will
just not show anything.

closes odoo/odoo#95037

Task: 2900450
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-07-04 14:07:54 +02:00
+2 48ef812a63 [REF] web: kanban, list and form views in owl
This commit introduces the new kanban, list and form views written
in owl. Even though it contains the implementation of those 3 views,
only the kanban view is activated for now (the list and form views
aren't 100% ready yet, so they aren't added to the view registry).

Alongside the views, the fields (<field name="..."/> in archs) and
widgets (<widget name="..." in archs) of web/ have been implemented
in owl as well. Legacy ones remaining in other addons are supported
in our new views, thanks to a compatibility layer. The goal is to convert
them asap though.

Legacy views, fields and widgets are kept for now, which explains the
number of added lines in this PR (around half of them concern tests).
They are still extended by custom code in other addons, that still need
to be converted (a lot of them are already on the way). Moreover,
they are still used in Studio as well. The plan is to lazy load them in
the Studio bundle when all custom code extending them will be
converted. Studio will be converted for v17.

Part-of: odoo/odoo#92475
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: luvi <luvi@odoo.com>
2022-06-30 09:29:44 +02:00
momegahed 4329584459 [FIX] web: multi lines don't work in warnings
Steps to reproduce:

1- install sales
2- allow warnings on sale orders
3- set a warning w with multiple lines on
 sale order on customer c
4- try to add c to a sale order
5- w will be shown in one line

Bug:

the html is escaped and the proper styling is missing

Fix:
add the proper style

OPW-2847660

closes odoo/odoo#94730

X-original-commit: 36546f39ca44f6d5691e3b1d8a7d1eb2da4a7b51
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mohamed Megahed Abbas Megahed SALLAM (mome) <mome@odoo.com>
2022-06-28 11:41:21 +02:00
Aaron Bohy a715e63b88 [IMP] mail,web: tests: crash if triggerEvent called on invisible el
Before this commit, the test utils that trigger an event (e.g.
click) didn't check whether the target of the event was visible.
As a consequence, when writing a test, one might trigger an event
on an invisible and undesirable target, and don't understand why
it doesn't work due to the absence of feedback. This commit
improves that situation by throwing an error in those sitations.

Obviously, some tests relying on the former behavior needed to
be slightly adapted.

closes odoo/odoo#93549

Related: odoo/enterprise#28360
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-06-14 22:07:08 +02:00
Hubert Van de Walle (huvw) a499263dd3 [FIX] web: mail.MessagingMenu isn't always added in the systray
Steps to follow

  - Use chrome
  - Connect to a runbot with the demo account
  - After a couple refreshes, the mail.MessagingMenu isn't displayed

Cause of the issue

  The navbar should be updated when there is a new item added to the systray registry.
  For that, the navbar listen to the update event with the `useBus` function.
  `useBus` itself uses `useEffect` which only starts listening after a component has been mounted/patched.
  -> The update callback is never called in this case because new items are added before the callback is registered.

opw-2801467

closes odoo/odoo#92768

X-original-commit: c2fd26881ceae95417e2a0afc71fdf8567e3b8c0
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2022-06-02 16:54:25 +02:00
tsm-odoo 3573a7fef4 [IMP] mail, *: use wowlEnv instead of the legacy one
*: bus, calendar, hr, hr_holidays, im_livechat, mail, mail_bot, note, project,
sms, snailmail, test_mail, web, website_livechat, website_slides.

task-2582313

closes odoo/odoo#83774

Related: odoo/enterprise#26493
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-05-30 19:40:53 +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
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
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
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
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
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
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