Commit Graph
2375 Commits
Author SHA1 Message Date
Aaron Bohy ff6e89052d [REF] web,*: regroup custom hooks in core/utils/hooks
*base_automation,iap,im_livechat,point_of_sale

This commit introduces a new file in core/utils: hooks.js
This file contains custom hooks (useEffect, useService, useBus...).

The useHotkey hook is tightly related to hotkeys, so it has been
moved to core/hotkeys.

closes odoo/odoo#74535

Related: odoo/enterprise#20003
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-08-02 11:13:52 +00:00
Lucas Perais (lpe) 83eb9f9ebd [FIX] web: action_service: onClose callback can execute history-back
Have an action in the breadcrumb (A)

Do an action (B) that has a button which spawns a dialog with a onClose callback executing an`history-back` event.
This may be useful when the action (B) acts as a selection buffer between (A) and the dialog.
(e.g. stock_barcode: execute `stock_barcode_client_action` from a picking)

Before this commit, the history-back event just closed the dialog without going back to the action (A)
This was because the wrong condition was used to determine if the dialog was still alive or not.

After this commit, the action (A) is displayed when closing the dialog from any point.
2021-08-02 07:55:52 +00:00
Sébastien Theys 810d5fd8aa [IMP] mail, im_livechat: add new UI for inviting members on channels
Opportunity is taken to clean the various follow/join/invite methods into only
one `add_members` method.

Part of task-2360169

closes odoo/odoo#74425

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-07-30 15:52:33 +00:00
Simon Genin (ges) 7719f39e68 [FIX] web: fix readonly mode for url widget
The readonly would not clear the old content when new content was put
through an onchange.

closes odoo/odoo#74476

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-30 10:26:06 +00:00
Francois (fge) bfa2d9c205 [IMP] web: refactor Command palette
The purpose of this commit is to make the palette command customizable.

From now, it will be possible to add spaceNames to modify the commands
displayed in the command palette.
For example, if I add the spaceName '@' and associate a provide function
with it, then when I type "@" in the search bar of the command palette,
the commands generated by provide will be displayed.

const commandProviderRegistry = registry.category("command_provider");
commandProviderRegistry.add("example", {
	nameSpace: "@" ,
    provide: (env, options = {}) => {
        return [{name: "myCommand", action: () => ()}]
    },
});

It will be possible to define several provide functions for the same
namespace. This will make it easy to add new commands when installing
a new addon.

Now it is possible to define commands that modify the state of the
command palette. This allows a command to change the placeholder
and commands displayed in the command palette.

closes odoo/odoo#73750

Related: odoo/enterprise#19970
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-07-30 08:26:09 +00:00
Samuel Degueldre 4c7ef96974 [REF] web: refactor debug menu to use context in env instead of service
This makes the debug menu more natural to use, and makes the difference
between the "in-dialog" and "out-of-dialog" debug contexts explicit.

closes odoo/odoo#74346

Related: odoo/enterprise#19967
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-07-30 06:01:42 +00:00
Mohammed Shekha 9aab080c1c [IMP] web: remove click event from attachment_image
With this commit: we remove click event from attachment_image widget, this is
specifically done so that when user clicks on kanban cover image kanban record
is opened, actually kanban record global click check if any of the child has
click event then it does not open on click.

task-2524022

closes odoo/odoo#74383

X-original-commit: a46b9ac37a0121102ddab44eca5ba6d6be82cb80
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2021-07-28 16:57:42 +00:00
Mohammed Shekha 7fbe05cdd6 [FIX] web: prevent no content helper on delete/archive list records
before this commit: when deleting or archiving or unarchive all records of last
page in listview user is displayed with NoContentHelper while we still have
other records in previous page, user should be moved to previous page if all
records of last page are deleted.

after this commit: if user deletes or archives or unarchives all records of
last page in list view then user is moved to previous page.

task-2446911

closes odoo/odoo#74091

X-original-commit: cead08fe6876239d1260b40948fcd74069496a2c
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2021-07-27 05:16:38 +00:00
Hardik Prajapati 6b90c0004d [FIX] web: resize list in form view overflows
Currently, When the One2many list contains a large amount of fields and the
user clicks or resizes the header, list takes table width as its initial width
and because of this list to overflows outside of the form view.
Issue raised after commit: d58edef12a

after this commit, clicking or resizing the list header does not impact the
width of the list.

TaskID-2388582

closes odoo/odoo#74277

X-original-commit: a145e1242118d3e539790327221486e1bd94e59a
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2021-07-26 17:44:29 +00:00
Samuel Degueldre 1eeab1e418 [REF] web: remove legacy rainbowman
The frontend code was still using the legacy RainbowMan, with the wowl
webclient, we rewrote this RainbowMan and started using that one
instead, but because the frontend code had no access to the wowl
environment, the legacy version was still used in the frontend. Since
the frontend now has access to the wowl environment, the old code can be
removed and the calls can go through the new effect service.

closes odoo/odoo#74148

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-23 12:14:10 +00:00
Michael Mattiello (mcm) 0864034f45 [FIX] web: fix quick edit text selection test
Before this commit, it could happen that the test fails.
We may be waiting too long on the second click in the test and so
the form switches to edit mode too early.
Now, we don't await the click to keep sync.

closes odoo/odoo#74157

X-original-commit: 01708583777cf33e9b505a494fdc5cdb66db86b5
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-23 11:04:29 +00:00
Francois (fge) b3de6f43d5 [FIX] web: display commands in the palette command
This commit avoids displaying commands associated with the wrong active
element in the palette command.

closes odoo/odoo#74149

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-23 09:50:28 +00:00
Mohammed Shekha 4e40979099 [IMP] web: o_form_label_empty on standalone label
Before this commit: when standalone label is rendered in form view class
o_form_label_empty is not added due to which label text is not muted.

After this commit: when standalone label is rendered, label is sometime
rendered before field widget is rendered due to which o_form_label_empty class
is not added to label, with this commit we postprocess labels so that
o_form_label_empty is added on all field labels.

Also with commit, signature widget's isSet method will return true if value is
set in signature widget, this will make label of signature widget muted if it
is empty and form view mode is readonly.

task-2523197

closes odoo/odoo#71322

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2021-07-07 08:29:28 +00:00
Mohammed Shekha 33c2615359 [IMP] web: remaining_days widget editable in edit mode
Before this commit: remaining_days widget is not editable and it just shows
information based on value like, Today, Yesterday, Tommorrow etc, when we
change mode to edit it should have date/datetime picker so that user can change
value of the widget.

After this commit: remaining_days widget will display date/datetime picker in
edit mode and in readonly mode it will display delta between the value of the
field and today, it will also support edition of date/datetime value in multi
edit mode.

task-2507961

closes odoo/odoo#70578

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2021-07-16 07:18:16 +00:00
Barad Mahendra e4967653be [FIX] web: fix the display of the time in year view popover
Currently, the time in popover of the year view does not appear
with the title due to record.allday is undefined instead of false

So in this commit, check if record.allday is not exist then display
the time infront of the title instead of after the title.

Related enterprise PR: https://github.com/odoo/enterprise/pull/19134

closes odoo/odoo#72440

Closes: #72440
Taskid: 2502339
Related: odoo/enterprise#19134
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-07-21 04:44:28 +00:00
Lucas Perais (lpe) 4919e50a3d [FIX] web: core: download: error handling
Try to download a report file but knowing that the controller will raise an Exception

in the case of l10n_be: Tax Report
Remove the VAT number on the Belgian Company and export the report as xml

Before this commit, the error was not well handled, i.e. a traceback was shown

After this commit, a Redirect dialog is shown, giving the possibility to the user to go
on the company's list view and change some company's fields.

closes odoo/odoo#74021

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-22 06:38:20 +00:00
Bruno Boi bb9ff3b62d [IMP] web: reload filtered kanban column if emptied
When dragging out the last record of a filtered column, its filter is cleared and the column is reloaded.

Taskid-2454209

closes odoo/odoo#72755

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-06-30 12:06:28 +00:00
Bruno Boi e248773826 [FIX] web: various filtering kanban column scenarii
BEFORE
Various scenarii leads to inconsistencies on the progressbars when a filter is activated:
- when dropping in a non matching record
- when the view domain is updated (e.g. from some input in the search panel)

NOW
These scenarii works fine.

Taskid-2491196
Taskid-2454209
2021-06-30 12:06:28 +00:00
Xavier Morel 27b02d2ec9 [FIX] web, *: de-t-raw kanban views
Add HTML fields support to kanban view (currently bespoke but maybe it
should be done via `format`), and remove t-raw for HTML fields there.

Also just strip some t-raws which were completely unnecessary to start with
2021-07-20 05:40:55 +00:00
Xavier Morel 5e987137a2 [FIX] web, project: remove t-raw from kanban example description
Descriptions which need to use markup should be explicitly marked as
such. Update examples test to check that both Markup and String
descriptions work fine.

`escFormat` had to be modified quite a bit and ended up requiring
being its own Markup-adjacent type: if the `sprintf()` result is wrapped
in a `Markup`, then what happens is we first decide to escape because
the object returned by `escFormat` only has a `toString()`, then that
blows up because `toString` returns a non-primitive object and the
regex used to implement `_.escape` is very very unhappy.

`escFormat` could return a `Markup` object but then it wouldn't be
lazy anymore which would rather miss the point.

Therefore implement `[_.escapeMethod]` on the thing, such that it
doesn't get escaped, because it's safe (ish).

Also as a result the icons probably don't need to be markup-ed. Oh
well shouldn't really matter.
2021-07-20 05:40:55 +00:00
Xavier Morel 7e1827a011 [IMP] web: prepare for de-traw-ification
A note concerning the attributes which I will probably need to take a
look at in the vdom version: the Python version has to process attf in
order to stringify individual elements, and separately stringify the
attribute value so it gets forcefully escaped even if it's
markup-safe (because markup-safety and attributes-safety are
different).

The first should not need to be performed on the JS side, because
Markup can not overload addition, therefore in JS String + Markup is
String whereas in Python it's Markup (and the String gets forcefully
escaped). In general, js!markup is currently much simpler than
py!markup, both by necessity (can't overload operators) and
simplicity (we might want to overload some of the operations
e.g. String#replace, but that's complicated and it's not been strictly
necessary for now).

Also wrt Markup / _Markup: `class` ctors can only be invoked with
`new` meaning they can't be used as template strings or regular
functions. Here `class` is useful to avoid the mess of calling the
super's constructor explicitly (which may not even be possible for
`String`), however it means we need a facade function to support our
use-cases.

Also update `utils.sprintf` to be Markup-aware: if the format string
is a Markup object, interpolated values get automatically escaped (if
necessary) and the result remains a Markup object.

If we need to perform explicit instance check we can always set
`Markup.prototype = _Markup.prototype` (I think), however in theory
that's not necessary: there are protocols in place for the relevant
pseudo-escaping operations and they ought suffice.

qweb/js divergence from qweb/py
===============================

Unlike qweb/py, qweb/js will *not* return a Markup object. That is
because in js a primitive `string` and a boxed `String` object don't
match when typechecking, and while `markup instanceof String` passes,
`typeof markup === 'string'` does not.

The overwhelming majority of string typechecks are the latter: there
are all of 6 `instanceof String` in the entire codebase, all in
dependencies, while there are hundreds of `typeof $X === 'string'`,
several of which get fed the output of template rendering
e.g. `jQuery.parseXML` or `AbstractView#init` (some widgets will
render a template then use it as the `arch` of a subview, so
`viewInfo.arch` can be the output of a qweb template rendering). This
makes for very annoying and somewhat gnarly debugging.

Plus jQuery in particular really doesn't like being fed a boxed
String, as it will interpret said boxed string as an array, and assume
it's an array of DOM elements to wrap, leading to a rather strange
jQuery object as output. Since feeding the result of a template
rendering to jQuery is a major use-case in non-vdom widgets... that's
a bit of an issue.

For the same reason while `_.escape` is `Markup`-aware, unlike
`markupsafe-escape` it does not *produce*, though it is
`Markup`-transparent.
2021-07-20 05:37:42 +00:00
Aaron Bohy 8c1d226284 [IMP] web: dropdown: add "toggler" props
This commit adds an optional "toggler" props to the Dropdown
component. If set to 'parent', no toggler will be generated by
the Dropdown component. Instead, the parent element of the dropdown
will be its toggler.

closes odoo/odoo#73858

Related: odoo/enterprise#19702
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-07-19 09:12:31 +00:00
Aaron Bohy 923ba830db [REF] web: dropdown: make "menu" the default slot
The dropdown Component takes 2 slots: one for the toggler, and one
for the actual dropdown content. Before this commit, the default
slot was the toggler, and the other one was named "menu".

However, as the toggler is actually optional, and the "menu" slot
contains the central information about the dropdown, we decided to
swap them. The content of the dropdown is now the default slot and
the toggler can be specified with the "toggler" slot.
2021-07-19 08:54:31 +00:00
Francois (fge) 7dc28604d7 [FIX] web: traceback generated by hotkeys
This commit fixes the erroneous tracebacks generated by keyup events
in the hotkey overlay. (alt + key)

TASK-2591069 - BUG 3
2021-07-19 09:11:14 +00:00
Francois (fge) 55dab0e7d1 [IMP] web: use of a default OS for tests
The purpose of this commit is to have a test environment
that does not depend on the OS of the machine
on which the Odoo server is deployed.

Because the navigator.platform is deprecated, we will use the
navigator.userAgent to identify the OS.
2021-07-19 09:07:09 +00:00
Yannick Tivisse 66876df938 [FIX] web: Pass session context to search panel
Purpose
=======

If the counters are enabled, this could lead to inconsistent counts,
as the session context (with allowed_company_ids) is not passed, and the
multi-company rules are not applied properly if we fall back on another
company that the ones on which the user is logged.
2021-07-16 12:02:56 +02:00
Samuel Degueldre 61dd61b6eb [FIX] web: avoid pushing state when ActionAdapter is in dialog
Previously, push_state events triggered from withing window actions
inside dialogs would bubble push their state into the URL even while
within a dialog, this is undesirable as this can cause the URL to become
invalid (eg by pushing the id of a record from an entirely different
model)

This commit fixes that by simply checking whether we are in a dialog
within the adapter before calling pushState.

task-2602458

closes odoo/odoo#73720

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-07-15 08:38:47 +00:00
Samuel Degueldre 95504aa0e1 [REF] web: remove legacy notification service
In previous commits, all references to the legacy notifications and
notification service have been removed, this commit removes the now
unused legacy notification and notification service

Part of #72675
2021-07-14 07:34:18 +00:00
Samuel Degueldre 08afc0af8f [REF] *: remove use of legacy notifications from tests
When writing the new webclient, the notification service was rewritten,
and all of its uses in production code were changed to use the new
services, however, some tests were still reliant on the old notification
service.

This commit removes references to the legacy notification service so
that we can be one step closer to removing it from the code base.

Part of #72675
2021-07-14 07:34:18 +00:00
std-odoo 47ba0a4e35 [FIX] web: fix the option "model_field" on the reference widget
Bug
===
Since cc67988241 a new option is available
for the reference widget.

When the new option "model_field" is used on a reference field in a list
view, after saving and then editing, we need to change the model to be
able to select the records

Links
=====
Task-2127615
See odoo/odoo/pull/46304
See odoo/enterprise/pull/7701
See odoo/upgrade/pull/848

closes odoo/odoo#46304

Related: odoo/upgrade#848
Related: odoo/enterprise#7701
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-07-14 08:32:59 +00:00
Aaron Bohy d85df9c50e [FIX] web: test: ensure to wait for dialog to be opened
Before this commit, the modified test sometimes failed on runbot.
We need to wait for an extra tick, because the dialog might be
rendered in another animation frame that the crashing client
action.

closes odoo/odoo#73675

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-07-14 08:34:14 +00:00
Aaron Bohy 09bc301387 [FIX] web: prevent test from failing randomly
Since [1], the modified test was failing randomly on runbot. Here
is what happened when it failed:
 - the initial action crashed
 - we toggled the menu dropdown
 - an error dialog was displayed -> the active element changed
 - the dropdown was closed (due to commit [1])
 - we asserted that the dropdown contained 3 items, but it was
   closed, so test failed.

[1] https://github.com/odoo/odoo/commit/300ef9ac6fc92bcfd9c37a6088df650e0af32018
2021-07-14 08:32:18 +00:00
Michael Mattiello (mcm) 75f6450ebc [FIX] web: remove tabindex on inactive modal
In the case we have a legacy dialog calling a new dialog,
tabindex set on the legacy dialog prevents the new dialog
to get focused as well as its children.
Because of this, we cannot select text or focus text input/area
in the new dialog.

closes odoo/odoo#73639

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-14 08:06:00 +00:00
Hardik Prajapati c3e12ee644 [FIX] web: centered event name while dragging in month mode
before this commit, the name of the event and hour is not
correctly centered while dragging the pill in month mode.

This commit fixes the issue by adding the CSS property.
after this commit, the name of the event and hour should be
correctly centered while dragging the pill in month mode.

TaskID-2506060

closes odoo/odoo#73553

X-original-commit: 59156daa150bf285626600f0a999dfe9838e1344
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2021-07-12 13:08:45 +00:00
Francois (fge) e95080792a [IMP] web, mail: Command palette
The purpose of this commit is to:
- Improve the design of the command palette
- Add few data-command-category and data-hotkey
- Scrolling through the command palette dropdown with the up/down arrows
should loop
- Moving the mouse over the palette command no longer causes scrolling

Task-2590390
2021-07-13 07:32:09 +00:00
Bruno Boi 300ef9ac6f [FIX] web: dropdown must close when activeElement change
When the UI active element changes, a opened dropdown should close.

Before: dropdown do not close
After: it is
2021-07-12 06:27:49 +00:00
Aaron Bohy 4b3dc07b52 [FIX] web: better handle error in actions
Before this commit, if there was a crash in a view or client
action during an update (i.e. the action is already in the DOM,
but an update triggers a re-rendering), the error was caught by
the action service, it wasn't displayed to the user, and the
action was re-rendered again (which could obviously result in the
same error being thrown again and again).

With this commit, we properly show the error, and we do not try
to re-render the action.

closes odoo/odoo#73507

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-07-12 13:40:26 +00:00
Aaron Bohy a8976144fe [FIX] web: correctly call dialog service 2021-07-12 13:40:26 +00:00
Francois (fge)andSergey Shebanin 7f10ca0d7c [IMP] web: make the hotkey service overlay modifier customizable
From this commit:
- It is possible to modify the overlayModifier allowing to display the
overlay and to access the data-hotkeys defined in the Dom.
- Adding a hotkey using the service or hook does not add the
overlayModifier anymore.

closes odoo/odoo#73279

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Sergey Shebanin <sergey@shebanin.ru>
2021-07-09 09:16:57 +00:00
Francois (fge) 20e157dd01 [FIX] web: doesn't apply the invisible data-hotkey
The purpose of this commit is to prevent the activation of data-hotkeys
associated with hidden elements of the dom.

Task-2591069 - BUG 1
2021-07-09 09:13:58 +00:00
Lucas Perais (lpe) a935096e51 [FIX] web: webclient: remove bootstrap tooltips more accurately
Before this commit, when hovering a button with a bootstrap tooltip set on it
(form view with header button in debug mode) and then clicking while staying hover
the tooltip was not destroyed and there was no easy means to destroy it.

After this commit, any click within a legacy context remove any bootstrap tooltip from the DOM,
since popper and tooltip are not meant to be used in the future in a wowl setting.

closes odoo/odoo#73447

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-07-08 15:28:01 +00:00
Jorge Pinna Puissant 54e9527ec2 [IMP] web, *: read session information from a module
* google_recaptcha, mail, partner_autocomplete, point_of_sale, website

Now, to read session information, the module "@web/session" must be
imported. Not that, there is also the user service with all the user
information.

closes odoo/odoo#73201

Related: odoo/enterprise#19434
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-08 14:13:39 +00:00
Anh Thao Pham (pta) e2fb83814e [FIX] web: fix resequencing after moving records with same sequence
- Install Sales > Configuration > Settings and activate Delivery Methods
- Create a SO as followed:
  * Add a section (i.e. Section 1)
  * Add a product (i.e. Product A)
  * Add a product (i.e. Product B)
  * Add a shipping (i.e. Delivery X)
  * Add a section (i.e. Section 2)
  * Add a product (i.e. Product C)
- Move (drag & drop) Delivery X to the first place
SO lines are reordered, but Product B is moved after Section 2.

It comes from the fact that some lines have the same sequence and that
only the lines between the source and the destination position are
re-sequenced.

Before the move, the sequencing is as followed:
 1) Section 1: 10
 2) Product A: 10
 3) Product B: 10
 4) Delivery X: 11
 5) Section 2: 12
 6) Product C: 13

After the move, only lines from 1 to 4 are re-sequenced. Leading to the
following sequencing:
 1) Delivery X: 10
 2) Section 1: 11
 3) Product A: 12
 4) Product B: 13

 5) Section 2: 12
 6) Product C: 13

As Product B has now a greater sequence than Section 2, it will be moved
after it.

If some lines between the source and the destination position have the
same sequence, all lines should be re-sequenced to prevent such a behavior.

opw-2531524

closes odoo/odoo#73456

X-original-commit: 8f64ac8ff2b94b66a8d8e94a8635727d0d53ca6b
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
2021-07-08 17:56:36 +00:00
Hardik PrajapatiandMohammed Shekha 2ebb34b7cd [FIX] web: open list optional fields dropdown position to right place
Currently, the optional field's dropdown displays outside of the form view when
columns are expanded. it happens because the left css property is applied when
the column is expanded.

This commit fixes the issue by applying the correct css property after this
commit, the optional field's dropdown should always be positioned on the
right side of the list in ltr mode.

closes #69727
TaskID-2510187

closes odoo/odoo#73411

X-original-commit: bbc338438518bbb7d0e9ad1a313e872f95a36870
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2021-07-08 10:03:09 +00:00
yograj tandelandMohammed Shekha 3603654006 [FIX] web: broken listview dropdown on state_selection
Before this commit: when clicking on an editable state_selection widget in
listview, the dropdown is not displayed. this is happening because overflow
of cell was hidden.

After this commit: when clicking on an editable state_selection widget in
listview, the dropdown is displayed. change overflow to visible for
state_selection column. Also fixed the issue when selecting option from
state_selection widget row was get edited or if it is not editable listview
then view is swithed to form view, it is because of event propagation which
we stopped here.

Task - 2485883

closes odoo/odoo#68129

Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2021-07-07 13:36:11 +00:00
Lucas Perais (lpe) 4fa4ff685a [FIX] web: load_state_tests: avoid undeterministic asserts
Before this commit, two tests had undeterministic outcomes:
they wanted to assert something in DOM was present at the same tiome as an owl rendering

After this commit, the problematic asserts are removed and the tests behave deterministically.

closes odoo/odoo#73379

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-07-07 14:31:04 +00:00
Mohammed Shekha 38fc6a6e80 [FIX] web: manually enter value in daterange throws error
before this commit: if user enters some random value in daterange widget and
click outside the daterange field it throws traceback while it should not throw
traceback, it should only warn user that you are entering wrong value.

after this commit: if user enters some random value in daterange widget then it
will show warning toaster that you are entering wrong value.

task-2410523

closes odoo/odoo#73366

X-original-commit: 588d133f3daf28e0ce69052ae57ad89c5a96eb3a
Signed-off-by: Simon Genin (ges@odoo) <ges@odoo.com>
2021-07-07 11:09:19 +00:00
Lucas Perais (lpe) 23da5621f3 [FIX] web: router_service: concurrent hashchange
Do an action that will change the hash.
During this, change the url hash to load another action

Before this commit, the hash taken to load the second action was wrong, because the first
action pushed its state instants before the hashchange event is actually triggered.
This is because the hashchange event is triggered in a non blocking stack
(https://html.spec.whatwg.org/multipage/browsing-the-web.html#scroll-to-fragid)

After this commit, the right action is loaded with the right hash

closes odoo/odoo#72878

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-07 09:16:38 +00:00
Géry Debongnie 2063b26b09 [FIX] web: add context in pyeval context
When the owl refactoring landed, we rewrote the pyjs evaluation system.
Then, we used the new system in the new code. In particular, the action
service uses it to evaluate the action domain.

But the previous code had a subtle behaviour in the special case of
evaluating domain: it added the context as a pydict object in itself, so
one could evaluate expression such as `context.get('a', 14)` to read the
value of a key in the context with a fallback.

With this commit, we uniformize this behaviour across all python
expression: the `context` key is now reserved, and used to access
anything in the current evaluation context.

closes odoo/odoo#73227

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-05 12:53:44 +00:00
Géry Debongnie f8ffa757c8 [IMP] web: optimize read/unlink when id list is empty
With this commit, we can simply skip performing a rpc when we know that
the id list given to read/unlink is empty.

closes odoo/odoo#73063

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-07-05 14:17:58 +00:00