Commit Graph
12376 Commits
Author SHA1 Message Date
luvi e756d9bc80 [FIX] web: anchor scroll crash
This commit fixes some issues happening when scrolling
with an anchor in Odoo. When the anchor was contained inside
of a notebook and no scrollable was found, a crash happens.
This fix improves the behavior in notebooks by showing the
correct pane before scrolling in form renderer. The scrollTo
util has been improved to remove duplicate lines and handle
multiple situations (0, one or more scrollables). Tests haven
been written to test such behaviors.

closes odoo/odoo#79935

X-original-commit: 4c2b807d1cb32e52a1b1fb5e6c80fb7e933940bc
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-17 13:51:54 +00:00
Michael (mcm) adc45af6de [FIX] web: set _super with Object.defineProperty
Before this commit, `_super` was set like this
`this._super = patchFn.bind(this);`
this triggered an update in owl reactivity.

To prevent the update, we use Object.defineProperty
`Object.defineProperty(this, "_super", { value: patchFn.bind(this) })`

closes odoo/odoo#79893

X-original-commit: a7a2b3022c88d1fbf9c242ad3668db35fc704c13
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-11-16 20:54:59 +00:00
Aaron Bohy 5d12f9ad96 [FIX] web: FieldDomain and DomainSelector in debug
Before this commit, the FieldDomain (using the DomainSelector)
didn't work well for manual edition of large domains (i.e. via the
"code editor"). For instance:
 - the editor was an input, so limitated to 1 line
 - the user friendly representation of the domain was redrawn each
   time the input was blured (we don't need this, and it flickers)
 - the count (search_count rpc) was recomputed at blur as well
   (could thus freeze the interface)

This commit fixes those issues as follows:
 - use a (automatically resizable) textarea instead of the input
 - do not format the content of the textarea when it is blured
 - do not update the user friendly part of the widget when the
   textarea is blured
 - do not recompute the count when the textarea is blured
 - add a button to allow to manually re-compute the count

For both debug and non-debug mode, we also no longer wait for the
count to be fetched to render the widget. We display a spinner
until the rpc is done.

Task 2619505

closes odoo/odoo#79886

X-original-commit: f4e3a754a1b66dd95fa3bfb50ec1fb8ac98864ed
Related: odoo/enterprise#22295
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-16 19:21:06 +00:00
Achraf (abz) 951270d12f [FIX] web: legacy action_menus: provide context to executeAction
In a list view in multicompany:
- select all records with the main checkbox above the list
- click on "Select All" to select every record for that domain
- open the "Actions" dropdown and try to do an action

Before this commit, there may be a fail on some records due to some
records not belonging to the right company.
This was because when fetching the active_ids from the server,
the context, and hence the allowed companies, was not passed to the RPC.

After this commit, the call to retrieve active_ids contains the allowed companies
and the correct records are returned and treated.

opw-2669292

closes odoo/odoo#79795

X-original-commit: 894430076423c81ec0804158249c354115030e9e
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Achraf <abz@odoo.com>
2021-11-16 08:20:30 +00:00
Pierre Paridans bed30d93cc [FIX] web: remove unused class o_py
closes odoo/odoo#79751

Related: odoo/enterprise#22244
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2021-11-15 12:07:21 +00:00
Amin Cheloh 02957fd919 [IMP] web: extract FieldBinaryImage img click handler
allow override handler in extended widget.

closes odoo/odoo#71773

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-15 09:47:56 +00:00
Sébastien Geelen (sge) cb1fcb598f [FIX] web_editor: fix ResizeObserver error in FF
The error "ResizeObserver loop limit exceeded" was catch by the browser error
global listener. this error was wrongly flagged as a CORS error.
This error is well known to be useless and can safely be ignored.

We do so.

Task-2670745

closes odoo/odoo#79645

X-original-commit: 1c21e2d6fa3c25d2a920902ebecd19f6229b56d8
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Antoine Guenet <age@odoo.com>
2021-11-15 09:04:32 +00:00
Aaron Bohy 1bb9cb89c8 [FIX] web: setup luxon locale from user lang
Before this commit, luxon wasn't configured with respect to the
user lang, meaning that months weren't translated (for instance,
in the filter menu, date(time) filter options, or in the datepicker
displayed in the "Add custom filter" sub-drodown).

closes odoo/odoo#79644

X-original-commit: 9530b0a2462aca0938ce315cee262b147b7a5634
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-12 08:25:53 +00:00
Tommy (tong)andAaron Bohy 114a5885ba [FIX] web: rpc error handling: use normal dialog if possible
Before this commit, automated actions could not raise "normal"
errors anymore (e.g. UserError). Indeed, since the wowl refactoring,
it always shows the custom BaseAutomationErrorDialog when an error
is thrown in an automated action, even if it is a standard error
well-known by the framework. Before the wowl refactoring, those
errors were handled normally if possible, and when it wasn't the
case, the custom BaseAutomationErrorDialog was used.

This commit restores that behavior.

Complete steps to reproduce:
- Install base_automation module
- Install an app for the base_automation to trigger (e.g. Sales)
- Turn on debug mode
- Go to Automated Actions
- Create an action with Action To Do is Execute Python Code and the Trigger is On Creation & Update
- Set the model to your app (e.g. SalesOrder)
- Put `raise UserError('Test')` in Python Code section
- Go back to the app, try to create a new record in the model you set for the automated action to trigger
- Compare the result with 14.0

closes odoo/odoo#79611

X-original-commit: d65d742de1b30a00b3ffd872c042e002736f7f6b
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2021-11-10 11:28:15 +00:00
Simon Genin (ges) a79ab876af [FIX] web: report client action can keep context on reload.
Report client action can need context data to be properly be
displayed. But because all the required data is not put in the url,
reloading didn't work.
However, there is the current action data kept in the session storage
which is a solution to avoid the described problem. But it didn't
work because of the implementation of the report client action execution.
It was in reality executing two actions: one for the report, gathering
the data and fallbacking to a client action. By doing this, the
session storage would not have the necessary data kept for reloading the
page.

The fix is simply to duplicate the code of the client action execution
instead of calling doAction again.

closes odoo/odoo#79567

X-original-commit: 3fc095c57888e5f69729e1a5a6edea97c4c098b6
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-09 14:46:33 +00:00
Bruno Boi 03aa013ce8 [FIX] web: indent navbar menu group entry
Before this commit:
Some navbar app sections items were
not properly indented in dropdowns.

After this commit:
The indentation is restored, leading to
a clearer usage of the navbar menus.

closes odoo/odoo#79545

X-original-commit: e8fad2c01b627b9cf0b696d68a59ec773015d6cf
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-09 11:48:55 +00:00
Pierre Paridans 968be6be55 [IMP] web: feature detection impl. normalization
This commit normalizes the different feature/browser detection modules'
implementations to avoid difference between "newer" implementation and
legacy ones.

Its main goal is to ease future maintainability by having only one
single source of truth for feature detection and, also ensure fixes
applied to one version are applied everywhere.

closes odoo/odoo#79499

X-original-commit: 3b90e15983edcb79e6bd6e45685926cd4dfaae6b
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2021-11-09 10:11:09 +00:00
Pierre Paridans a3779735ee [IMP] web: match DateRangePicker with datepicker revamp
Following commit odoo/odoo@ce4e6bd4b1 ,
the DateTimePicker design was revamped but not the DateRangePicker.

This commit adapts the DateRangePicker's styling to match the
DateTimePicker's design.

closes odoo/odoo#79497

X-original-commit: c5c944f4240dba8f8b100d73ef1a9c8870c705a7
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2021-11-09 10:10:58 +00:00
Pierre Paridans 9b0d2add11 [FIX] web,pos,website_event: DateRangePicker (S)CSS loading order
By being lazy loaded, the DateRangePicker library's CSS files where
loaded after the Odoo specific customizations (bundled in the common
assets), resulting in some CSS rules being overridden by the one from
the library.

This commit fixes it by removing the lazy loading of the library's
(S)CSS to be able to handle their loading order. Also as our
customizations requires SCSS pre-processing, they can't be lazy-loaded.

Note: the library's JS assets are stil lazy loaded to minimize the
performance impact of this change.

X-original-commit: 4436411b6fd898d1fa32a9149b7dc12efe3ef9f8
Part-of: odoo/odoo#79497
2021-11-09 10:10:58 +00:00
Pierre Paridans 986739c8ab [FIX] web: DateTimePicker (S)CSS loading order
Following commit odoo/odoo@8c55713dcc ,
the DateTimePicker (TempusDominus) library's SCSS file was pushed so low
in the (S)CSS assets loading order that it overrides the Odoo specific
customizations (done in `datepicker.scss` file).

This commit restores the correct loading order, also taking into account the
changes (i.e. variables) introduced in the afore mentionned commit and
fixing necessary CSS rules (cf. selected day's color) to keep the same
styling.

X-original-commit: 7fd486cd93154d680cb69e3f34aa04478bc62a63
Part-of: odoo/odoo#79497
2021-11-09 10:10:58 +00:00
Audric Onockx (auon) e22ffa3e7a [FIX] web : Fixed datetime filter search based on wrong hours
Reproduce :
(With timezone GMT+3)
- Create any record R1 with previous day's date and time after 21:00.
- Create any record R2 with today's date and time after 21:00.
- Create a filter to show all todays records (Date is between "<TODAY'S DATE> 00:00:00 and <TODAY'S DATE> 23:59:59".

Result :
  Even though R1 is in yesterday's date, it will show in the list.
  R2 will not show in this list.

Explanation :
  This behaviour has been observed in several modules, for any timezone but UTC & only with custom filters default datetime values.
  The search was applied on [datetime(UTC) + 2 * offset] because the timezone wasn't correctly set.

Solution :
  Timezone is now correctly set on default datetime values.

closes odoo/odoo#79516

X-original-commit: 6fd105b89ea30695d6a324a5aa0b2004987c2e47
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Onockx Audric (auon) <auon@odoo.com>
2021-11-08 15:36:19 +00:00
luvi ea53ad6af4 [FIX] web: remove a useless import
This commit removes a useless import from the
tests helper

closes odoo/odoo#79252

Related: odoo/enterprise#22022
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-08 08:40:09 +00:00
Géry Debongnie 2cf87ea02f [IMP] web: update owl to 1.4.8
Release notes: https://github.com/odoo/owl/releases/tag/v1.4.8

closes odoo/odoo#79337

X-original-commit: bfbd0d956f3a7a22a22dfb4c466b7a6f0a916a7d
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-03 19:00:46 +00:00
luvi d304be57be [FIX] web: scrolling to anchor working badly
This commit fixes a bug when you clicked on a link related to an anchor.
e.g. an <a> tag with an href="#anchor". The scroll to the element
with id="anchor" didn't happen because the position was not found correctly.
The fix uses getBoundingCLientRect to get more precise positions
of the element with the anchor and the scrollable area.
A test is introduced to check scrolling for multiple anchors in a template
with a more complex structure (Note: the test fails without the fix).
The scroll behaves differently depending if the target is an anchor or
an element. An other test has been added for the command palette about this
behavior.

closes odoo/odoo#79310

X-original-commit: b0da44d62f85d6530f8e568025f7fea25c5454c5
Signed-off-by: FrancoisGe <fge@odoo.com>
2021-11-03 11:48:46 +00:00
Xavier BOL (xbo) eb2ba319a1 [FIX] web: fix formatFloat when the value is null
Before this commit, when the value is null in the pivot view on a float
field, we format the value before displaying it. The problem is the
formatFloat method does not check if the value is null and used the
`toFixed` method to fixed the number of digits to display for the value.

This commit uses the value if it is not value otherwise use 0 to fixed
the number of digits. That is, when the value is null, the formatter
will return "0.00" (if the number of digits expected is 2) instead of
raise an error.

Steps to reproduce:
==================

1) Go to the helpdesk App > Reporting > Tickets Analysis.
2) Go to pivot view of this report.
3) Add the measure called "Rating (/5)"

Expected behaviour:
==================

Show the pivot with empty cells or 0.00 if the average of this measure
has no values.

Actual behaviour:
================

Traceback shown because it cannot read 'toFixed' property of null.

task-2665899

closes #79034

X-original-commit: d142705d9262dfa5fb489611ae0b5a2a04ff6fab
Part-of: odoo/odoo#79291
2021-11-02 16:59:55 +00:00
Hubert Van de Walle (huvw) 706d2f01ae [FIX] web: basic_renderer: delay destroy after render when rerendering widget
Steps to follow

  Edit the account.move view (with studio for example)
  Set the lines readonly property to [["partner_id","=",False]]
  Create a new move
  Add a partner
  Add a product
  Remove the partner
  -> A traceback appears: widget.$el is undefined

Cause of the issue

  widget.$el is used after the widget has been destroyed

The fix was already present in 14.0 (3fd7b2009e)
but we still need to keep the test

opw-2557142

closes odoo/odoo#79261

X-original-commit: 71e6d7e510ff9d44fe8deb16f29d50b021709074
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2021-11-02 13:11:34 +00:00
Michael (mcm) df72d187e1 [IMP] web: add "unique" array utility function
This commit adds "unique" array utility function which
returns a copy of the given array but without any duplicates.

closes odoo/odoo#76472

Related: odoo/enterprise#20833
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-11-02 10:45:15 +00:00
Michael (mcm) 13686e0e19 [IMP] web: http service in webclient test helper
Before this commit, `setupWebClientServiceRegistry` didn't use
http service but some tests need it.

Part-of: odoo/odoo#76472
2021-11-02 10:45:15 +00:00
Michael (mcm) d1c8a565ab [IMP] web: add pager to new framework
Before this commit, Pager was not implemented in the new framework.

Part-of: odoo/odoo#76472
2021-11-02 10:45:14 +00:00
Michael (mcm) 3ef8083dcb [FIX] web: autofocus conditional element
Before this commit, useAutofocus hook used the effect dependency
to check if the target is in dom but this dependency is computed
in onWillPatch and can be outdated when checking it in onPatched.

Now, the target isn't a dependency anymore and is computed just
before the check.

Part-of: odoo/odoo#76472
2021-11-02 10:45:14 +00:00
luvi 8e09f540d0 [IMP] web: clamp util and touch event helper
This commit adds touch events helper for tests and new util used
to constrain a number between two values. The purpose of
the commit is to introduce the ActionSwiper component using those
functionnalities.

closes odoo/odoo#78426

Related: odoo/enterprise#21712
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-29 17:20:06 +00:00
Francois (fge) 6470606d65 [FIX] web: Command Menu with custom icon
Before this commit, if you create a new app with a custom icon with
studio and you open the command palette with the namespace "/", then
you will have an error message.

We have this error because the home_menu does not support custom menu
icons.

closes odoo/odoo#79158

X-original-commit: c5f5b1de07ee6b8b09ae1821c4c0debc0d09f55e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-29 06:09:07 +00:00
Aaron Bohy e3f08513c2 [FIX] web: router: do not push unnecessary entries in history
Before this commit, the router didn't considered as equal an
integer value given as an integer or as a string (e.g. "1" or 1),
whereas form the url point of view, it's exactly the same, and the
information is lost anyway.

As a consequence, pushing something like { id: "1" } in the url
that already contained id=1 created a new entry in the history,
which isn't what we want as the url is the same.

This commit fixes the issue by converting string values into
numbers when it is possible.

This commit also changes the way the action service pushes the id
and active_id in the url, as there's no need to pass string values
anymore (this was the case in the early days of the wowl branch).

closes odoo/odoo#79132

X-original-commit: e576155fc55e0493a1d1236960dd1c7a36db9e8c
Related: odoo/enterprise#21948
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-28 13:06:00 +00:00
Simon Genin (ges) 5f5e699baa [FIX] web: Form stat button stays correctly disabled
A stat button set as disabled was used to just show some statistics
without an action on click. However, on tasks executed by the Form,
all the buttons would be temporarly set as disabled then set back to
enabled. This would lose the original state of the button and make them
all clickable.

The way it worked before v14.5 was most likely because the action
manager would not throw an error on an action with those "invalid"
arguments.

Also, a button without a type and name will now be set the disabled
attribute automatically.

closes odoo/odoo#78839

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-27 21:53:57 +00:00
luvi 29f83c0306 [FIX] web: missing template when editing ControlPanel
This fix adresses an issue when editing the control panel from Owl based views.
Currently, if you don't have a custom search to an Owl view, the template editor will appear blank as the component misses its searchViewId value from its props.
The commit also introduce a test when clicking the edit ControlPanel button in that case.
With the fix, you can edit the search template and get the default template

closes odoo/odoo#79023

X-original-commit: f5c8e855f07d68a34dccd9977b53999911a66f62
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-26 19:40:51 +00:00
Mohammed Shekha d4727f4424 [FIX] web: support readonly attribute on toggle_button widget
before this commit: applying readonly attribute on toggle_button doesn't work,
toggle_button still clickable and value is still changed even though widget is
readonly, there is no effect of readonly attribute on toggle_button widget.

after this commit: if toggle_button widget has readonly attribute then it will
not be clickable, button of toggle_button will be disabled so that user can
easily understand that element is not clickable.

task-2339995

closes odoo/odoo#79012

X-original-commit: 74d42d4a328c517d0ced56d9e437fb40b00a14d0
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-26 13:23:24 +00:00
xO-Tx 23fe084c4c [FIX] web: fix menu items width calculation
ISSUE:

The width of menu items is computed (in 'initAutoMoreMenu')
to check for overflow and fold extra items in a "+" dropdown.

[1] When the page is not in cache yet, the width is computed
while font is not loaded yet and the value obtained is not
the same when font is already available [2] (e.g. if we go
to another page).

This explains why we get an additional folded item comparing
[1] and [2].

The goal of this commit is to fix this behaviour by recomputing
the width after font loading.

IMPORTANT REMARK:

When the code was overridden on 'initAutoMoreMenu', the idea
was to update the menu as soon as the DOM is available and add
adjustments after in this order:

[A]- _adapt();

[B]- await _afterImagesLoading(...);
   _adapt();

But since it's not possible to prevent the changes in menu
width after images are loaded, we remove the first update
in [A] (This update has no effect in current code because
it was placed after the "await..." in [B]).

And we still start the updates on menu after image loading.

task-2618929

closes odoo/odoo#78959

X-original-commit: 69b97d8e95da3efa62882228e79dc357e19e0fe6
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-26 07:48:01 +00:00
xO-Tx 04f09503b2 [FIX] web, website: fix initAutoMoreMenu on user navbar
The current code in 'initAutoMoreMenu' doesn't work properly
on navbar after the update on dropdown in [1]. Small tweaks
were added in this commit to fix that.

[1]: 84715436d87bb05b421bc9ccaacda67d07571690

task-2618929

X-original-commit: 29b9280c44534d2f210dbcea83e0049365949f48
Part-of: odoo/odoo#78959
2021-10-26 07:48:00 +00:00
Xavier Morel 468eb84fb4 [FIX] web: race-ish condition in qweb test suite
By delaying the check of `didLogInfo` until run end, it becomes
possible for the test suite to start running before all the test
modules have loaded, which leads to some of the modules loading after
the test suite "ends" and start running at that point, leading to
multiple teardowns of the test suite.

This would occur in the POS test suite, leading to the `QUnit.done`
callbacks running multiple times, and multiple `"test successful"` to
be emitted.

This has historically not been an issue (hence having remained
undiscovered), but with the "success state" being a `Future` it now
breaks the corresponding test, as a resolved future can not be
re-resolved.

Part-of: odoo/odoo#77735
2021-10-25 09:53:11 +00:00
Xavier Morel 7962484c81 [FIX] web: make loading promise boolean-returning,
The new handler changes the behavior of `wait_ready`: before it would
wait for the `ready_code` to be `true` *or a settled promise*.

Now it waits for `wait_ready` to resolve to true, whether it's a
promise or not.

Part-of: odoo/odoo#77735
2021-10-25 09:53:11 +00:00
Xavier Morel f22d2cf595 [FIX] web: test hit position
Apparently the calendar now suffers from 94018575c6 on the brand new Chrome 94...

Part-of: odoo/odoo#77735
2021-10-25 09:53:10 +00:00
Achraf (abz) a7a932c7fd [FIX] web: Fix components position in modal
When a componentes is in a modal and uses the positioning hook (filter dropdown in the Search More modal for example), it will shifted from the toggler button.
This is due to a `-webkit-transform: translate3d (0, 0, 0);` applied on the `modal-body`
which influences the `position: fixed` attribute of `.o-popper-position` in the `dropdown-menu`

"It is positioned relative to the initial containing block established by the viewport,
except when one of its ancestors has a transform, perspective,
or filter property set to something other than none (see the CSS Transforms Spec),
in which case that ancestor behaves as the containing block. "

See: https://developer.mozilla.org/en-US/docs/Web/CSS/position

the translate3d was applied with https://github.com/odoo/odoo/pull/20314
As the bug is no longer exists, we can remove this style.

opw-2668638

closes odoo/odoo#78775

X-original-commit: 1f86e285aeb69578378cc89771cd090cc29ccc7d
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Achraf <abz@odoo.com>
2021-10-25 08:42:58 +00:00
Bruno Boi 6fe52c9012 [FIX] web: adjust FullCalendar for luxon v2
See preceding commit

closes odoo/odoo#78797

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-22 09:52:44 +00:00
Bruno Boi d2cdcd9058 [IMP] web: update luxon from 1.25.0 to 2.0.2
See [upgrade guide](https://moment.github.io/luxon/#/upgrading?id=_1x-to-20)

Part-of: odoo/odoo#78797
2021-10-22 09:52:43 +00:00
Louis Wicket (wil) 7c76f29111 [FIX] mail, web: properly add messaging menu to the systray
This commit intends to fix two strange bugs encountered while trying to
push a new component into the systray menu:
- MessagingMenuWidget and RtcActivityNoticeWidget were removing their
parent node via DOM manipulations when attached in the DOM. This caused
a crash when adding other items to the systray menu since the deleted
nodes were actually managed by OWL.
- The t-foreach directive in the navbar used indexes as the t-key, which
led mapping items subsequently added to wrong templates.

closes odoo/odoo#78784

X-original-commit: 5f0f80da4fc951954d253c9e45defd591605f556
Related: odoo/enterprise#21829
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Ooming <oomsveta@users.noreply.github.com>
2021-10-21 18:02:06 +00:00
Nidhi Patel f5db920f0b [FIX] project,web: fix project status color in kanban progress bar
Currently, projects that are 'on hold'  stage are represented in grey in
the kanban progress bar while the colored dot on their card is in blue.

In this commit, we change the color of the 'on hold' stage into 'info'
instead of 'muted'. After this projects that are 'on hold' are display
blue in the kanban progress bar as well.

Task-Id:2633273

closes odoo/odoo#78761

X-original-commit: 0886c10d5f276aca2539060ffaa047780a408354
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-10-21 15:47:14 +00:00
Aaron Bohy 9c5fecdf90 [FIX] web: ActionContainer: properly unbind handler
This isn't a problem in production, because the ActionContainer is
never destroyed, but it caused a small memory leak in the test
environment.

closes odoo/odoo#78698

X-original-commit: d01c89d80d58763e45309dbcfbf83f852866982e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-10-20 15:15:24 +00:00
Aaron Bohy 3feba2da91 [FIX] web: ui service: remove leak in tests
Before this commit, the ui service listened to the "change" event
on several MediaQueryList corresponding to specific window sizes.
However, those event handlers were never removed. Whereas this
isn't an issue in production (services are started once and live
forever), this caused a memory leak in tests, where services are
deployed on demand, test by test.

There is no cleanup function for services (since they live forever
by nature). In the test environment, we have a solution for handlers
bound on window (i.e. window.addEventListener), by monkey patching
the function (thanks to the browser object), and automatically
removing all handlers bound during a test, at the end of that test.

This commit fixes the memory leak by no longer using addEventListener
on MediaQueryList (as this is a deprecated feature anyway [1]), and
simply using window (or browser)'s addEventListener instead. This
leak sometimes produced a timeout in the QUnit test suite [2].

[1] https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener
[2] https://runbot.odoo.com/web#id=2374&action=573&model=runbot.build.error&view_type=form&cids=1&menu_id=405

X-original-commit: d86cc5c016cf4eff9a7e4f8b35a9ed38ddc24636
Part-of: odoo/odoo#78698
2021-10-20 15:15:24 +00:00
Aaron Bohy 7bd4ae9566 [FIX] web: prevent some tests from failing undeterministically
This is a tricky one. The problematic tests involve the quick edit
feature. Before this commit, those tests sometimes failed [1],
because there was no guarantee that we waited enough in the test
before doing assertions.

[1] https://runbot.odoo.com/web#id=2012&action=573&model=runbot.build.error&view_type=form&cids=1&menu_id=405

X-original-commit: 78762d0a0017e02f2df00d60140a2709fafaa0d5
Part-of: odoo/odoo#78698
2021-10-20 15:15:23 +00:00
Aaron Bohy 0c8b5c5da8 [FIX] web: attempt to fix non deterministic issue in tests
This commit *could* prevent a test from failing randomly. The
important part in the diff is the switch from $.Deferred to native
Promise. JQuery Deferred behave differently upon resolution (it is
sync if the deferred is resolved directly, whereas it is not the
case for native Promise). I couldn't find any other reason to
explain why the test was sometimes failing. There is no reason to
use Deferred anyway.

The issue didn't occur after this commit in more than 600 builds.

[1] https://runbot.odoo.com/web#id=2297&action=573&model=runbot.build.error&view_type=form&cids=1&menu_id=405

X-original-commit: ed0761dce44bd37cdd9d40ddd6e021517f466f97
Part-of: odoo/odoo#78698
2021-10-20 15:15:23 +00:00
Aaron Bohy b6ef017f64 [FIX] web: make test more robust
Before this commit, the changed test sometimes failed on runbot
(rarely though), because it might happen that the debounce released
before the promise returned by the click helper resolved (e.g. if
the server was overloaded, or was garbage collecting...). That
promise waited for a setTimeout, and then for a nextAnimationFrame.
In this scenario, there's no need to wait so long, as there is no
rendering to wait for.

Example of failing build: https://runbot.odoo.com/runbot/build/10360554

X-original-commit: 880c4683698c987f212e4a113b374230566001f1
Part-of: odoo/odoo#78698
2021-10-20 15:15:23 +00:00
Aaron Bohy f9594fba3f [FIX] web: patch: can call a not bound patched function
Before this commit, it wasn't possible to patch some functions
(e.g. setTimeout) on window, because of the way we call them.
Indeed, we typically do `setTimeout(...)`, because this function
doesn't need to be bound to the window object.

X-original-commit: 476dbf75bb88dc2ddfdd47c1f229ce53cf7fadb7
Part-of: odoo/odoo#78698
2021-10-20 15:15:22 +00:00
Bruno Boi 39777c9039 [FIX] web: always add usercontext to legacy action
In the new web client architecture, the user context is added to server
requests through the ORM service and is therefore not needed in the
action context. Thus the commit 7354d16 has removed it from the action.

Before the new webclient architecture, the user context was always
prepended to the action context. So this commit reintroduces it for
the legacy views and client actions through their proper adapters.

closes odoo/odoo#78685

X-original-commit: 7975674166a3d8fa9cd8714adab769a7fd681368
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Bruno Boi <brboi@users.noreply.github.com>
2021-10-20 11:44:58 +00:00
Bruno Boi 8687a220b7 [FIX] web: do not keep additional context in stored action
Before this commit
The current action is stored in the session storage with its evaluated
context. This design is wrong because a context is by definition
contextual which means it has to be evaluated at the last possible
moment to ensure it reflects the most recent context.

After this commit
The current action is now stored in the session storage it its most
original state. This is sufficient as in any case actions go through
the doAction method which evaluates the context right before applying
the action logic.

X-original-commit: 2533d47a1d312907389fb85af83f8812c402a609
Part-of: odoo/odoo#78685
2021-10-20 11:44:58 +00:00
std-odoo a7618b96ec [FIX] web: do not write before saving when clicking on a radio
Bug
===
If we open a view in readonly mode, click on a radio widget and if a
constraint exists on this field, an error message is raised.
(e.g. the enroll field in "website_slides_sale").

Technical
=========
This is because in the "Basic controller", in the "_onFieldChanged",
we force "force_save" if the view is in readonly mode. This is wanted
for widgets that can change the value even in readonly mode
(e.g. Priority), but clicking on a Radio widget switch the mode to edit,
so this is not needed.

To fix that, we call `setValue` after switching to the edit mode. So
the `setValue` is skipped in `_onInputClick` if we are in readonly mode,
and the `setValue` is done in `_quickEdit` instead.

Task-2668763

closes odoo/odoo#78684

X-original-commit: ff1329ca86691dd5f042158de6913c4aa2c69b6c
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-10-20 11:44:52 +00:00