Commit Graph
16220 Commits
Author SHA1 Message Date
abd-msyukyu-odoo 64d48616c9 [FIX] knowledge: make removeContextUserInfo a web asset
removeContextUserInfo was a Spreadsheet asset, which is not a dependency of
Knowledge.

In order to make this feature available for all modules, it is moved in web as
an object util, that needs to be used alongside the user service in order to
dynamically remove user context information (no hardcoding).

Task-3017349

closes odoo/odoo#104304

X-original-commit: fd88fc1bbad4c0cdb44cf634b6a5621eb7597e0d
Related: odoo/enterprise#33322
Signed-off-by: David Beguin (dbe) <dbe@odoo.com>
2022-10-27 15:41:21 +02:00
Samuel Degueldre c989ff339d [IMP] web: report module loading errors in the DOM
Previously, if there were module loading errors, they would typically
happen before the error service was ready, and so there is almost always
no user-facing error that shows up even though the application state may
be severely corrupted. This can be very confusing for developers who are
not used to working with JS and might not check the devtools console.

This commit makes it so that the module system will replace the contents
of the body with an error when some modules were unable to be loaded,
with the list of modules and the reason, so that the developer is not
confused as to why things aren't working as expected.

closes odoo/odoo#104155

Signed-off-by: Samuel Degueldre <sad@odoo.com>
2022-10-27 15:41:15 +02:00
Pierrot (prro) 6acc85639a [FIX] web: adapt bold layout to new header
The previously created company_details field was introduced to allow
customers to manually edit part of their pdf headers. Only the bold
layout was not updated with this field.

closes odoo/odoo#104299

X-original-commit: 16ece79ea5305a2e427024a43313096fa200901f
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
2022-10-27 14:41:26 +02:00
Joseph Caburnay c412f11c02 [REF] web,web_*: import owl features using "@odoo/owl" module
In @odoo-module files, we do the following conversion:

`const { ... } = owl;` -> `import { ... } from "@odoo/owl"`.

While in legacy odoo module (odoo.define):

`const { ... } = owl;` -> `const { ... } = require("@odoo/owl");`.

closes odoo/odoo#104260

Task-id: 3032274
Related: odoo/enterprise#33298
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-10-27 14:41:17 +02:00
Joseph Caburnay d650ab6a9b [IMP] web,im_livechat: introduce @odoo/owl module
This is done so that using owl features and functions is done using
the standard import syntax, instead of destructuring properties out
of the owl global object.

So instead of just:

`const { Component } = owl;`

inside an odoo-module, we now do:

`import { Component } from "@odoo/owl";`

Note that we haven't removed the global `owl` object so existing
code will work as is.

Furthermore, we also augmented the tsconfig.json that's generated
from the tsconfig subcommand to take into account the path
of owl.js.

Task-id: 3032274
Part-of: odoo/odoo#104260
2022-10-27 14:41:17 +02:00
Joseph Caburnay bcf2cf7d65 [FIX] web: introduce parser for many2one_reference field
ISSUE: When in debug mode, user have access to the "External
Identifiers" view. The search bar allows searching using "Record
ID" which is a `many2one_reference` field. When user inputs
a search query that can't be converted to number, "Record ID"
option is still available to the user. It results to traceback
when it's selected because the UI is creating an invalid "domain"
which makes the server search for a string on an integer
(many2one_reference) field.

Check the video for illustration: https://youtu.be/XEPUXHcjeRI

SOLUTION: We make sure that many2one_reference field is properly
converted when generating the domain from the search_bar by
using the integer parser. This basically excludes many2one_reference
field from the search options when the input query is not a valid
integer. See it in action: https://youtu.be/NQ-YrK6tDH0

closes odoo/odoo#104183

Task-id: 3005837
X-original-commit: bc9e8709309379bdd9191323cb015c89be7da1f9
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-10-27 11:38:47 +02:00
Ivan Yelizariev c2536e1f0b [FIX] web: handle apps store actions neatly
Apps store menus currently don't work and they are redirected to local Apps
menu. Because the warning message says "Odoo Apps will be available soon", user
may click such menu few times and notice growing breadcrumps, which looks buggy:

Apps / Apps / Apps / Apps / Apps / Apps / Apps / Apps / Apps / Apps / Apps

To reproduce: activate debug mode and click menu Apps / Updates

opw-2985389

closes odoo/odoo#104158

X-original-commit: a8481b73449db65eaca0b1e34a49a15a46d3d1f9
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Ivan Elizaryev (iel) <iel@odoo.com>
2022-10-27 11:38:45 +02:00
Sergey Shebanin d00cfd62b8 [FIX] form control panel: display long breadcrumbs correctly
UI improvements for form control panel to correctly display long breadcrumbs.
It touches both desktop and mobile views.
Before this commit Action menu, Pager and Create button shifted by long breadcrumbs outside the screen.

closes odoo/odoo#104208

X-original-commit: f2b71d51aa409eae435f31d433dac4290c2b80ab
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2022-10-27 09:39:38 +02:00
Audric Onockx (auon) 5dd5fec563 [FIX] web: format float time correctly
Steps:
Go to timesheet (grid view).
Launch the timer.
Got to list view and check the new line.

Issue:
Few seconds before the minute, the seconds are negative.

Fix:
Convert hours decimals in milliseconds before calculating minutes and
seconds.

Also deleted the unnecessary condition for abs().
Also changes some `${...}` to String(...) to reduce noise.

closes odoo/odoo#104209

X-original-commit: 9d3e7ab4e903d2ada99693aa23e024d3ff84f5fb
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-10-27 07:15:47 +02:00
FrancoisGe b305128323 [FIX] web: DateField dropdown disappears on scroll
Before this commit, the Datefield dropdown did not close when you
scrolled on the page.

How to reproduce:
- Go to a form view with a date field
- Click on the date field input (datepicker is opened)
- Scroll down the page

Before this commit:
 The datepicker is still open

After this commit:
 The datepicker is closed.

closes odoo/odoo#104160

X-original-commit: d93ed838fdf0a721426dc56e26b5a83b3af6a66f
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2022-10-26 21:51:51 +02:00
xmo-odoo e806427d23 [REM] web: deprecated dataset methods
Part-of: odoo/odoo#98138
2022-10-26 19:03:46 +02:00
Jorge Pinna Puissant 886f3de768 [IMP] web,*: force props validation for components
*: base_automation, lunch, mail, mrp, project, web_editor, website

This commit adds a warning if the props validation is not set for a
component.

The props validation is important to tell how a component should be
used, by looking at its code, it's a good documentation of the component.
It's also critical, to test if the component is correctly used, if all
the obligatory props are passed and that there are of the correct type.

For more information, see: https://github.com/odoo/owl/blob/master/doc/reference/props.md#props-validation

closes odoo/odoo#103723

Related: odoo/enterprise#33044
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-10-26 16:07:18 +02:00
Valentin Vallaeys (vava)andValentin Chevalier 693511076d [IMP] Payment: hide the URL payment link
Since the generated payment link is not editable, it is hidden behind
the wizard copy button.

To help the users understand the button, the text on the button can now
be edited in the xml with a `label` attribute.

task-2683480

closes odoo/odoo#100261

Signed-off-by: Vallaeys Valentin (vava) <vava@odoo.com>
Co-authored-by: Valentin Chevalier <vcr@odoo.com>
2022-10-26 15:06:48 +02:00
Bruno Boi a0f4957304 [FIX] web: moment.js to luxon's conversions
The web client exposes an utility function that converts the tokens
of a luxon's DateTime format into a moment.js format.
While this function is not false (still it is uncomplete), the strategy
of using it to convert a luxon's DateTime object into a moment.js moment
is not good.

The daterange field make use of this bad strategy.

Because of the differences between luxon and moment.js locale handling.
Luxon relies on the native JavaScript Intl API.
Moment has its own implementation of locale handling.

So having to pass through formatters/parsers may yield to unexpected
results. For instance, when a locale does not have the same way (in
moment.js and Intl) to express i.e. months and we try to convert a
luxon's DateTime into a moment by formatting the first and then
parsing into the second, the second will be invalid. This is the same
the other way around.

This was in fact encountered with some locales, i.e.
- syrian arabic (ar-SY)
- albanian shqip (sq-AL)

This commit brings an alternative strategy by providing other utility
functions to directly convert a moment into a luxon's DateTime
and vice versa.

This is a better strategy for various reasons:
- it abstracts the way the conversions are done
- no need to play with timezone's offsets
- probably all libs that has moment as a dependency accept a moment
  object in their options, that may not be the case for formats

- The daterange field now use the new strategy
- The datepicker component now use the new utility functions as it had
  implemented locally something similar.

closes odoo/odoo#104138

X-original-commit: 9dedfcaa4ad1fb5ea24f604b40df1bf0830617cb
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2022-10-26 14:05:53 +02:00
Florian Damhaut 9d778a7346 [FIX] sign: fix frame CSS for all screen size
Change CSS rules for the sign frame to make it more responsive

task-id : 2993103

closes odoo/odoo#104109

X-original-commit: a77f4f24c374254e1c13d9d5b5b538c7562eb96d
Related: odoo/enterprise#33209
Signed-off-by: Arnaud Joset <arj@odoo.com>
2022-10-26 14:05:42 +02:00
Joseph Caburnay 5a460d1cfa [FIX] web: useNumpadDecimal: synchronize the inputs listeners
This makes sure that the handler is properly assigned/removed
to/from the added/removed input elements.

closes odoo/odoo#104114

X-original-commit: d88b5e96a4d4a80dd14a271538a4669a6efd2d48
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-10-26 09:07:46 +02:00
Joseph Caburnay 5bbd8a05dd [FIX] web: useNumpadDecimal should take into account the selection
When NumpadDecimal is triggered, appending the decimalPoint to the
input field value is not enough, rather, we should replace the selected
range.

Also, we should ignore this for input field of type="number" because
it's natively taken into account.

X-original-commit: 3389cd2226ec82df9aa015637ac2d6a405936a4a
Part-of: odoo/odoo#104114
2022-10-26 09:07:46 +02:00
Xavier Morel 59442f0988 [IMP] web: open external links of PDFs in new tab
Reimplementation of 74fa91e0b3 on top of
new version of pdfjs. See previous commit for explanation.

Ideally we would set that behaviour from the outside using
e.g. `PDFViewerApplicationOptions.set` but there are multiple
locations from which we embed the viewer, which makes that a difficult
proposition. There should probably be a clean component which handles
loading the library, configuring it to our specifications (possibly on
a per-embed basis), and exposing both manipulations methods and events
which pdfjs triggers on its eventBus.

Part-of: odoo/odoo#100067
2022-10-26 09:07:34 +02:00
Xavier Morel 55d9f318fb [IMP] web: update pdfjs to 2.16.105
Our current version is getting rather outdated. Replace by
the *legacy* bundle: pdfjs now provides a non-polyfilled version of
the library, which is probably faster though it doesn't save overly
much (for the entire bundle anyway). Use polyfilled version for
safety, though it's unclear whether non-chromium Edge is still
supported by Odoo. If not, we could just use the non-polyfilled
version.

The difference is quite large for pdf.js (+32.5%), however it is much
less consequential for the sandbox (+1%) or for the much larger
worker (+5.6%). The biggest difference is likely performances
but... who knows?

Notes:

- The main reason for this change is that automated vulnerability
  scanner have apparently started scanning for `postMessage(..., '*')`
  and the previous bundles includes a version of corejs polyfills
  without zloirock/core-js#542), therefore triggering those scans. As
  the PR notes this is almost certainly not a concern because of the
  innocuous payload, but there is no reason to waste time on those
  reports if we don't *have* to.
- The bundle now includes "standard fonts", those were removed as
  they're heavy and may not be necessary for our usage (?).
- All the bitmap images were dropped and replaced by svgs, which is
  nice.
- The local changes since the previous update were *not* impacted in
  this, the entire thing was just reset to upstream. This means
  changes which were backported (922c7c72, 6943714f) are superseded
  but more odoo-specific changes will have to be reapplied in further
  commits.

Part-of: odoo/odoo#100067
2022-10-26 09:07:34 +02:00
Romain Estievenart a172be756f [REF] web,*: dark mode uses service instead of legacy api
This commit adapts the codebase to match its enterprise counterpart
where calls to legacy cookie api (cf. web.utils.cookies) are replaced by
cookie_service ones.

closes odoo/odoo#104080

X-original-commit: 724469e19ff83e91a41c6721e334df1ad8d1c02c
Related: odoo/enterprise#33189
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2022-10-25 19:39:51 +02:00
Romain Estievenart e574a13a6d [FIX] web: disable dark mode on test suites
As the current test suites are "light mode" based and to avoid
unexpected errors when running them locally (due to the cookie
possibibly being already set), the dark mode is disabled
for the following suites:
- `web.qunit_suite`
- `web.qunit_mobile_suite`
- `web.benchmark_suite`

X-original-commit: 3f1b44f0d2ce72f79308ef36cd72ea3f7b82b186
Part-of: odoo/odoo#104080
2022-10-25 19:39:51 +02:00
FrancoisGe f4dc9b1f96 [FIX] web: leave an invalid list view
Before this commit, if an invalid list view is left, then a "View can't
be saved" error dialog is displayed.
The expected behaviour is a notification indicating the invalid fields.

How to reproduce:
- Go to a list view with at least one required field
- Create a new record
- Edit this record while leaving the required field empty
- Leave the view

Before this commit:
You stay on the view and get the "View can't be saved" error dialog.

After this commit:
You stay in the view and you get a notification "Invalid fields: "
with the invalid fields displayed.

closes odoo/odoo#104082

X-original-commit: 98fbacd8511594ca7a8cc9f0afa5d199a9b2ff20
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-10-25 17:16:22 +02:00
FrancoisGe 9927ee6d4e [FIX] web: click on a readonly field on editedRecord
Before this commit, in a list view, if you click on a readonly field of
a record in edit mode, then it switches to readonly mode.

Why ?
The "pe-none" class added to readonly fields will prevent clicking on it.
Our click will then be applied to the table causing a unselectRecord
on the list.

How to reproduce:
- Going into an editable list view with a readonly field
- Click on a field to switch the record to edit mode
- Click on the readonly field

Before this commit
 The record switches to read mode

After this commit
 The record stays in edit mode

closes odoo/odoo#104070

X-original-commit: 52c817b88b5c799322a19f49807126928d9f28e1
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Signed-off-by: Georis François (fge) <fge@odoo.com>
2022-10-25 17:16:19 +02:00
FrancoisGe 84d55a2b57 [FIX] web: click several times on a readonly field in multi_edit
Before this commit, in a multi_edit list view, if you click twice on
a readonly field, the focus is placed on the readonly field.

How to reproduce ?
- Go to a list view in multi_edit="true" mode with a readonly field
- Select a record
- Click on the readonly field of the selected record
- The record goes into edit mode and the focus is placed on the editable
  field following the readonly field
- Click a second time on the readonly field of the selected record

Before this commit:
        The focus is placed on the readonly field.

After this commit:
The focus is placed on the next editable field.

X-original-commit: aac7e6e4de371dcd01028a3a9ab66eed022c1ef0
Part-of: odoo/odoo#104070
2022-10-25 17:16:19 +02:00
Lucas Perais c90aec080b [FIX] web: kanban dropdown without toggler
In a kanban arch, have a dropdown that don't have a toggler, just an
explicit menu.

Before this commit, there was a crash.

After this commit, the kanban and the dropdown are correctly rendered.

closes odoo/odoo#104019

X-original-commit: 01418c474cb02455660156cf47822588f0554376
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-10-25 17:16:13 +02:00
Lucas Perais 084012a29b [FIX] web: kanban correct display of field without widget block mode
Have a kanban arch with a field in display full in the kanban card template
```<field name="fieldName" display="full" />```

Before this commit, the class that should endup in the DOM was wrongly computed.
Technically, it was quoted in the owl template as if we passed it to a Component.

After this commit, a field having display="full" is correctly rendered.

X-original-commit: 526eb4f875ec6736d4b76da1fbdbcc99a8c33a9b
Part-of: odoo/odoo#104019
2022-10-25 17:16:13 +02:00
Lucas Perais cb39355ee8 [FIX] web: kanbanRecord honors useViewCompiler API
Before this commit, the usage that KanbanRecord makes of useViewCompiler was faulty in that
it did not respect the hook's API (the last argument is a dict params, not a string).

After this commit, the usage of useViewCompiler by KanbanRecord is correct.

X-original-commit: 8dbf7c88742e4603543005a1d5a158e5e0db2feb
Part-of: odoo/odoo#104019
2022-10-25 17:16:12 +02:00
Achraf (abz) e885885d74 [FIX] web: Allow user to "search more" when adding o2m field
Steps:
  - Open studio in any list view
  - Try to add o2m to the list view
  - Select a related field
  - Click Search more
  - traceback "ViewClass is not defined"

Since https://github.com/odoo/odoo/commit/186a8b31161fc8c75b346ff97f9403dca1ae677e#diff-5e3a43184a718068d966f2ea2eb972fb54b9795a8efa5c8e8cd99ab07a4e2cdfL19
the form, kanban and list view have been removed from the registry.

opw-3020871

closes odoo/odoo#103980

X-original-commit: 19f98f7eb316a49a754eb68ea1352834a1e2a2e6
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Achraf <abz@odoo.com>
2022-10-25 13:03:39 +02:00
Lucas Perais ec86454778 [FIX] web: legacy kanbanRecord kinda supports luxon
The new WOWL Kanban view supports that luxon be used in the archs.
Legacy kanban had a similar support but for moment.js

Obviously, new archs can't work with legacy implementation because of this.
This commit aims at providing some sort of hackish support, only valid in
the transition phase.
At least one use case has popped up, that is, when editing such kanban view with Studio.
In that case, there was a crash, which is fixed with this commit.

closes odoo/odoo#103821

X-original-commit: 14f56b324d241f35b742781424535cecf26a218e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2022-10-25 11:07:11 +02:00
FrancoisGe 7870375962 [FIX] web: wrong style for many2one_avatar external button
Before this commit, fields using Many2OneField in their template (for
example, the many2one_avatar field) had a wrong style for the external
button (the arrow on the right to open the record in form view).

closes odoo/odoo#103981

X-original-commit: c63493ab7b19a238304b2d7791c28bf1a52c0d2f
Signed-off-by: Luca Vitali <luvi@odoo.com>
2022-10-24 18:59:33 +02:00
FrancoisGe e4862f26f4 [FIX] web: reload record when you click on attach_document
The goal of this commit is to restore the behaviour of the legacy
attach_document widget.

How to reproduce :
- clicking on the attach_document button and selecting a file

In legacy:
We have a full reload of the view (Render and reload the record).

Before this commit:
Render the view without reloading the record.

After this commit:
We reload the model which causes a rendering of the view and a reload of
the record.

Why do we have to reload the record ?
If the action linked to the attach_document button modifies the record,
we want this modification to be applied in the view and not only on the
server side. To do this, we need to reload the record data to ensure
that all the changes are displayed in the view.

closes odoo/odoo#103891

X-original-commit: 82d4f0cd2f0265393cf66cd7be1a0a714584400c
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Signed-off-by: Georis François (fge) <fge@odoo.com>
2022-10-24 14:12:26 +02:00
William Henrotin 1ed423a181 [FIX] web: make pdf viewer expands on notebook
Similar to the html field widget, this commit add the display: block
class to the pdf viewer widget in order to make it use the whole area of
a notebook zone:

Task: 2991906
X-original-commit: a1407975c2fafedef5f5eb7d4597cfcd88117e49
Part-of: odoo/odoo#103872
2022-10-24 09:16:55 +02:00
FrancoisGe 0055542952 [FIX] web: edit a required field in a list view in multi_edit
Before this commit, in a list view in multi_edit mode and editable="0",
it was possible to edit a required field with an invalid value.

Why:
In the PR 101924, we decided to no longer pass readonly/required of fields
in non-editable views (if no editable="1").

Solution:
To know if a view is editable, you should not only look if it is
editable="1" but also if it is multi_edit="1".
So we want to pass the readonly/required fields if the view is
editable="1" or multi_edit="1".

How to reproduce:
- Go to a multi_edit="1" and editable="0" list view with at least one
  required field on the server side
- Select the checkbox of the record you want to edit
- Edit that field with an invalid value (e.g. clearing a text field)
- Click outside the line being edited

Before this commit:
The record is saved with the invalid value

After this commit:
An alert dialog is displayed to warn us that the value is invalid.
The record returns to readonly mode with the old value.

closes odoo/odoo#103790

Related: odoo/enterprise#33066
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2022-10-23 12:30:03 +02:00
FrancoisGe c998fdd77b [FIX] base: consider multi_edit="1" views editable
Since odoo/odoo#95729

nodes with a `groups=` are completely removed from the views when
the user is not part of the group, instead of being made invisible.

In that PR, views have been adapted to add back fields, with invisible="1",
when they were required, for instance when they were used in a domain
of another field which was still there despite the user is not part
of the given group.

As `tree` views having `multi_edit="1"` where not considered
as editable views, the domain of fields in these views were not
validated:
- https://github.com/odoo/odoo/blob/1fb8fa16ab7dc298d54f089d7163fb556dbc5fcc/odoo/addons/base/models/ir_ui_view.py#L1460
- https://github.com/odoo/odoo/blob/1fb8fa16ab7dc298d54f089d7163fb556dbc5fcc/odoo/addons/base/models/ir_ui_view.py#L1321-L1322

while they are well required for the web client,
in `multi_edit="1"` this is possible to edit relational/many2one field,
and therefore it will do `name_search` calls using the domain of the
field, and therefore the fields used in these domains must always
be present in the views. Without it, a crash in the web client occurs
when attempting to edit the relational/many2one field.

This revision targets to consider the `multi_edit="1"` tree views
as editable, to make the field domains validated as they should be.

Hence, views are adapted to add back fields with `invisible="1"`
when they are required in domains of other fields.

Part-of: odoo/odoo#103790
2022-10-23 12:30:03 +02:00
Bruno Boi c964462774 [IMP] web: update owl from 2.0.0-beta-22 to 2.0.1
Release notes: https://github.com/odoo/owl/releases/tag/v2.0.1

- fix: runtime: correctly throw an error for duplicate object keys
- fix: parser: give t-set-slot="default" priority over the content
- fix: blockdom: correctly reorder children in heterogeneous t-foreach
- fix: portal: correctly move portal content when target is after it
- fix: blockdom: fix event_catcher traceback when a parent component has an empty child

closes odoo/odoo#103847

X-original-commit: be996cf423ce09be4e4661c0b42a97d92a4dcdb4
Related: odoo/enterprise#33097
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2022-10-21 23:13:48 +02:00
Hubert Van de Walle (huvw) 7b948a731f [FIX] web: discard rejected reloadProms in magicReload
Steps to reproduce:

  - Go to a list view with multiple items
  - Click on an item
  - Delete it
  - Go back in history twice (Using the browser navigation) to return to the list view
  -> We can't click on another record

opw-2854113

closes odoo/odoo#103808

X-original-commit: 92c90823139b413c8289d1c323ad694fc8220a61
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-21 17:17:19 +02:00
Sergey Shebanin 0c0656eadd [FIX] web: statusbar field on mobile doesn't show current value
closes odoo/odoo#103715

X-original-commit: a045d4555f3546bf9b0327b24f5c6f3fecf247f1
Signed-off-by: Luca Vitali <luvi@odoo.com>
2022-10-21 10:11:14 +02:00
Loan (lse) a03f5cd631 [FIX] web: improve error message when missing the format type of field
To reproduce:
1. Create a (incorrect) view manually. For example, inherit from
`res.config.settings.view.form` and do add the following view architecture:
```xml
<data>
  <xpath expr="//div[hasclass('settings')]" position="inside">
    <field name="field-dont-exist" widget="upgrade_boolean"/>
  </xpath>
</data>
```
( In practice, Odoo will refuse to let us save the view if it is incorrect
(we can bypass that by pushing directly in the database for testing) )

-> When trying to open the settings app, you will have a cryptic JS error:
`TypeError: field_utils.format[(formatType || this.formatType)] is not a function`
The goal of this PR is to improve the error to ease its correction.

Note: This issue can happen in practice after an upgrade or a failed
uninstallation of a module.

OPW-2952309

closes odoo/odoo#103686

X-original-commit: 73dccc3e51472f76cf5cf32a4fbd48d0b58b5c36
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-21 08:23:54 +02:00
Bruno Boi d54bff857a [FIX] web,calendar: calendar and popovers design
Fix the hatching and striking effects for events
by moving some scss rules to the right place:
- o_event_hatched
- o_event_striked

Various fixes for the calendar popovers to display properly, such as:
- year scale popovers
  - proper popover body padding and font-size
  - style that depends on attendee status
- other scales popovers
  - inverse the condition when the popover footer must shrink

closes odoo/odoo#103661

X-original-commit: 917d8e4123517c73d8bd6a4bd83becf1b0ee1090
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2022-10-20 17:17:09 +02:00
Bruno Boi c9bec348db [REM] web: calendar unused design classes
This commit removes some style that is dead code, related to classes:
- o_cw_custom_hover
- o_cw_nobg
- o_calendar_hatched
- o_calendar_hatched_*
- o_calendar_striked
- o_calendar_striked_*

X-original-commit: 4a19e031ae70a44369970147dd1735da66a9ea64
Part-of: odoo/odoo#103661
2022-10-20 17:17:09 +02:00
Aaron Bohy b7dfc7f71c [FIX] web: SearchPanel: fix race condition with sections
This commit fixes a race condition spotted by the click all test,
in the Lunch application. To reproduce, go to Lunch > Configuration
> Products, in the list view, toggle filter "Archived" s.t. there's
no record matching the domain (and nothing displayed in the search
panel anymore), then switch to kanban view, and remove the filter.
On a multi-build, this scenario fails ~4 times out of 10.

The issue occurs because a re-rendering of the search panel is
triggered by its parent (because of the filter change), but the
search panel didn't compute its active sections yet (this is done
when the "update" event is triggered on the search model). The
exact situation is hard to reproduce, but if there are non empty
sections in the model, and the active sections haven't been computed
yet in the search panel, it crashes. For instance, it happens all
the time by delaying the promise returned by "_fetchSections".

This commit doesn't introduce a qunit test because we didn't manage
to reproduce the exact same situation in a test. This makes the
Lunch click all test pass all the time though.

closes odoo/odoo#103638

X-original-commit: b84df7e08b4d413de2e8a0b1df6cb8d6ad4b08cf
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-20 14:14:56 +02:00
Aaron Bohy 3f12de691b [FIX] web: ConfirmationDialog: do not call confirm twice
Before this commit, multi clicking quickly on the "Ok" or "Cancel"
buttons of a ConfirmationDialog would call the confirm/cancel
callbacks multiple times. For instance, in "Mass mailing", create
a new mailing and click "Send". In the confirm dialog, clicking
quickly multiple times on "Ok" would call the "Send" button action
multiple times.

This commit also ensures that we wait for the promise of the
confirm callback before closing the dialog. This highlighted an
issue in the ORMBatcher, as we didn't reject the promise when
the batched rpc failed. As a consequence, the confirmation dialog
never closed itself. This has been spotted by an existing test.

Fixing #74647 (from 16.0 to master)

closes odoo/odoo#103572

X-original-commit: 95f8266a5b84f5faa59a713019ab713392b3ef78
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-10-20 10:19:58 +02:00
FrancoisGe 70a80d4cd1 [FIX] web: click on wrong options in autocomplete
The purpose of this commit is to fix an indeterminate error in
the test_03_sale_quote_tour.

Error: UncaughtTypeError: Cannot read properties of undefined (reading
'unselectable')

Why:
In the autocomplete component, it is possible to replace the sources
without it being rerender. It is therefore possible to click on a option
that no longer exists in the component's internal state, which causes
the crash.

Solution:
We wait that all the sources are loaded before replacing them.

closes odoo/odoo#103497

X-original-commit: f25df0be75082caf9e8ed62c581a13fe82a27546
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Georis François (fge) <fge@odoo.com>
2022-10-20 10:19:47 +02:00
Mathieu Duckerts-Antoine 6aac153473 [FIX] web: py.js: offset in to_utc
Take a (py.extras) datetime representing the moment "2022-10-17 00:00:00"
in the timezone of Brussels. Trying to get the related utc moment through
to_utc gives wrongly "2022-10-16 23:00:00". This happens because the
months are not numbered in the same way in Date or datetime, so that in
October for example, the offset applied was that of November which is
-60 instead of -120 (summer/winter change). We fix that problem.

closes odoo/odoo#103579

X-original-commit: ee1a8d26f241f2f7bea6880afcc946119b0e6bd8
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-10-19 20:47:54 +02:00
Mathieu Duckerts-Antoine e0b852bc6e [FIX] web: core: offset in to_utc
Take a PyDateTime representing the moment "2022-10-17 00:00:00" in
the timezone of Brussels. Trying to get the related utc moment through
to_utc gives wrongly "2022-10-16 23:00:00". This happens because the
months are not numbered in the same way in Date or PyDateTime, so that
in October for example, the offset applied was that of November which is
-60 instead of -120 (summer/winter change). We fix that problem.

closes odoo/odoo#103561

X-original-commit: a11e1fb5f702400fe51938362fe3f24570977ba9
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-10-19 18:06:59 +02:00
Joseph CaburnayandBruno Boi 390955b751 [FIX] web: fix traceback when shift-tab on list field
**Before**

A traceback is raised when pressing shift-tab on the first column of
the first row in a focused list field as shown in the vid:
https://youtu.be/g97ZTp1QdBE

**After**

shift-tab on the first column of first row will now unselect the list field
and immediately focuses on the previous field.

**Additional change**

We now allow skipping focus on the dropdown toggler by introducing new
props.

closes odoo/odoo#103485

X-original-commit: 9ba9977e42d201035b5299bc13ba03211cddbc1f
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
2022-10-19 12:10:41 +02:00
Mathieu Duckerts-Antoine 8c2ec7b4de [REF] web: remove PieChart
Now that the module web_dashboard has been removed https://github.com/odoo/enterprise/pull/31641,
the component PieChart is unused. We remove it.

closes odoo/odoo#102761

X-original-commit: 3e92c60034cedcd999572bb7e93c8b05ca07be70
Related: odoo/enterprise#32573
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-10-19 11:11:53 +02:00
Mathieu Duckerts-Antoine dcb0498ab8 [REF] web: remove unused props in reporting views
Now that the module web_dashboard has been removed https://github.com/odoo/enterprise/pull/31641,
some props of the reporting views graph and pivot have become unused.
We remove the code related to those props.

X-original-commit: 7d231d1d37707dab4b0ecdd4e2e7cc4535ba6196
Part-of: odoo/odoo#102761
2022-10-19 11:11:53 +02:00
Mathieu Duckerts-Antoine 9f4130bd57 [FIX] web: kanban, list: no search model in env
When a x2many record is opened in a X2ManyFieldDialog, it can happen
that the form renderer displayed in the dialog also contains a x2many
that use a kanban or list renderer. In those cases, the View component
is not used. Consequently, the WithSearch component responsible for
making available a search model in the env is not used either so that
a crash occurs at the setup of the kanban renderer (and sometimes later
on for the list renderer). We fix that problem.

closes odoo/odoo#103349

X-original-commit: 2c284317b6dc3c0f0b4e9e376dcee755d81222da
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2022-10-19 10:14:55 +02:00
Thomas Lefebvre (thle) b4f9086bff [FIX] web: correctly append attribute expressions
Steps to reproduce:
    - install "Peru - Accounting" module (l10n_pe module);
	- try to open a contact form.

Issue:
    An error message appears with an impossibility of access to the form.

Cause:
    The function that concatenates the different attributes should not take into account the "{{ ... }}" tags already put in before.

    Example:
    When appending `scope && scope.className || ""` to `{{props.record.isInEdition ? 'o_form_editable' : 'o_form_readonly'}} d-block {{ props.record.isDirty ? 'o_form_dirty' : !props.record.isVirtual ? 'o_form_saved' : '' }}`;
    This is generated:
    `{{{{props.record.isInEdition ? 'o_form_editable' : 'o_form_readonly'}} d-block {{ props.record.isDirty ? 'o_form_dirty' : !props.record.isVirtual ? 'o_form_saved' : '' }} scope && scope.className || "" }}`
    instead of:
    `{{props.record.isInEdition ? 'o_form_editable' : 'o_form_readonly'}} d-block {{ props.record.isDirty ? 'o_form_dirty' : !props.record.isVirtual ? 'o_form_saved' : '' }} {{scope && scope.className || "" }}`

opw-3018917

closes odoo/odoo#103460

X-original-commit: 846d3b3c67e8ef46ecb29c5d72d895b2b852fc10
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
2022-10-19 07:21:55 +02:00