Commit Graph
16635 Commits
Author SHA1 Message Date
Benoit Socias fb9efde4f3 [FIX] *: replace werkzeug's Response by odoo's Response
*: base, http_routing, mass_mailing, web, web_editor, website_slides

In some situations `werkzeug.wrappers.Response` are used instead of
`odoo.http.Reponse` that extends it.
This is a problem because since [1] the calls to `set_cookie` expect it
to accept the `cookie_type` parameter, which is not the case in the base
werkzeug implementation.

This commit replaces the `werkzeug.wrappers.Response` by
`odoo.http.Response`.

[1]: https://github.com/odoo/odoo/commit/2cbda6c98ee947cea1d06c09880eee8c758304a8

closes odoo/odoo#112827

X-original-commit: 28da08292b7028575e628c5ad846fc05d30498f2
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-02-16 09:01:07 +01:00
luvi c4b6a8445e [FIX] web: fix copying to clipboard no longer working
Since commit (1), the write/writeText were no longer correctly called,
because the browser native functions couldn't be called. Sometimes, it
raised the "Illegal invocation..." error, or could have an unexpected
behavior, preventing the value to be copied in the clipboard, which made
the button pointless.

No additional test was added, since it is difficult to test the clipboard
API programmatically, and the current test coverage is all that we can do,
without using the real clipboard object.

(1): 9cdcd1c1f7219030386d2c90205ea083eb835a13

closes odoo/odoo#112843

X-original-commit: 767922d43334a6cbccdb4be64f207813240fd314
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-16 08:02:08 +01:00
Vincent Schippefilt 05b85b085a [FIX] web: error when focus is inside a kanban card
repro steps:
1) in any kanban view that is not grouped, use the arrow key to focus the last card
2) use the up key to focus the previous card
3) use the TAB key to focus any element inside that card
4) use the down key to try to navigate to the last card -> traceback

The error comes from the fact that `focusNextCard` assumes that the
focus is exactly on the card element and not on any of its children.

closes odoo/odoo#112797

X-original-commit: 76434f4959cd0fade41ad02f790226f1a8046fea
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-15 16:03:00 +01:00
Aaron Bohy cfc5da5b30 [REF] web: remove unused legacy stuff
This commit removes the legacy CustomCheckbox and the backward
compatibility layer for the systray items. Both of them are no
longer used.

closes odoo/odoo#112718

Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-02-15 13:36:51 +01:00
luvi 49159d791e [FIX] web: fix displayed label of the SelectMenu
This commit fixes the wrong label that was displayed when options
are defined inside groups. Since displayValue was only looking for
a label on choices set using the choices props, the getter was only
returning the technical value for choices defined in groups.

A test has been modified to verify that the correct label is shown,
also on choices present inside of a group. This test previously
asserted that, but only on choices given by the choices props.

closes odoo/odoo#112766

X-original-commit: 176e61d5c25111a1e9339a0687bb526d1d430790
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-02-15 12:33:47 +01:00
FrancoisGe 365fe390fd [REF] web: remove redirect in router
The redirect function in the router exists only for the wait option.
This option is only used in one case (client action home). We have
therefore decided to remove the redirect function and to call
browser.location.assign(...) directly.

We will also remove the "wait" param for the "reload" and "home"
client actions. Because no call to "reload" needs it (1) and all calls to
"home" want it wait=True. So we will move the code that was executed
if wait=true to the "home" action client.

(1) In the POS, wait=true is used for a "reload" but this has no impact.
Wait=true was intended to wait for the server to restart before reloading
the page. In the case of the POS, there is no restart of the server, so
wait=True is useless.

closes odoo/odoo#112621

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-15 10:14:42 +01:00
Samuel Degueldre 1b1fd52148 [REF] point_of_sale, pos_restaurant: refactor draggable behaviour
Previously, the resize behaviour and the draggable behaviour were
completely separate, even though a lot of the logic for both behaviours
is common to both. This commit replaces both of these behaviours with a
hook: useMovable that lets the user drag an object around, but lets the
caller customize the behaviour on drag: when dragging a table or the
debug menu, we want to move the object around by setting its position in
its container, but when dragging a resize handle around, we want to
resize the table while keeping the handle position in the table the
same.

This commit also makes a bunch of popups non draggable as it doesn't
make sense for them to be draggable: you cannot interact with the
content behind the popup for as long as the popup is open (unlike the
debug menu), and serves no functional purpose, and may occasionally
confuse users.

closes odoo/odoo#112610

Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
2023-02-15 10:14:39 +01:00
FrancoisGe b0b1b889f7 [FIX] web: KanbanView onCreate with sample data
The goal of this commit is to disable sample data mode when creating
a record using an on_create action in an empty kanban view.

How to reproduce:
- Go to an empty kanban view with an on_create and sample="1"
- Click on the create button
- Validate the creation

Before this commit:
    The kanban view is still in sample data mode.

After this commit:
    The kanban view deactivates the sample data mode.

closes odoo/odoo#112732

Taskid: 3176939
X-original-commit: b5909daaa16466321a0ad85aaf013155c0bcf5b2
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-15 08:07:41 +01:00
Aaron Bohy 145540921f [REF] web,mail: handle "color_field" option in M2MTagsField
Before this commit, there was a hack done in Field.js to handle
a special case of the Many2ManyTagsField which sometimes require
an additional "color" field to be fetched. This field is given in
option on the many2many field, in the arch.

It wasn't possible for the Many2ManyTags field to add that field
on its "FieldToFetch", because this object was static (it didn't
depend on the arch). This commit allows it to do so as FieldsToFetch
can now be a function that receives the fieldInfo (extracted from
the arch) in arguments.

So with this commit, fieldsToFetch can be either an array of fields
(instead of an object as before), or a function returning an array
of fields.

Part of task 3179751

closes odoo/odoo#112518

Related: odoo/enterprise#37020
Signed-off-by: Georis François (fge) <fge@odoo.com>
2023-02-14 17:09:29 +01:00
e93988ea65 [REF] mrp, web: OWL GanttView
Community counterpart of the enterprise commit having the same name.

This commit acts as a setup to allow for the reworked gantt view to work
properly.

Task Id: 3105022

Part-of: odoo/odoo#110819
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-02-14 17:09:06 +01:00
Bruno BoiandJulien Mougenot 24fb77d457 [IMP] web: Draggable hook builder
This commit adds several improvements and overall changes the way
draggable builders can be built, adding some helpers to temporary
manipulate DOM elements during drag sequences and making some changes
on the way drag callbacks are handled.

The current implementations of draggable hooks built with this feature
have been adapted.

The drag test helpers have also been reviewed to more accurately
mimick real-life scenarios and allow for more flexiblity (i.e. moving an
element to a certain point during the drag sequence before being
dropped).

Part-of: odoo/odoo#110819
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
2023-02-14 17:09:05 +01:00
Julien Mougenot 1ac6ae1801 [IMP] web: Add support for Elements in tests
Before this commit, some QUnit asserts and test helpers taking a
"target" param (or equivalent) would try to evaluate it, among other
possibilites, as an HTMLElement.

This is too restrictive however, as all these helpers can also be
performed on 'Element' instances (querySelector, classList, etc.), which
covers other sub-classes than HTMLElement, such as the whole range of
SVG Elements.

This commit changes the checks for `instanceof HTMLElement` to
`instanceof Element` instead to allow the helpers to be used on the
whole range of native Elements.

Part-of: odoo/odoo#110819
Co-authored-by: Julien Mougenot <jum@odoo.com>
2023-02-14 17:09:05 +01:00
Mathieu Duckerts-AntoineandMathieu Duckerts-Antoine f3dfd9b651 [REF] web: Move orderByToString to views/utils.js
This commit moves the 'orderByToString' helper to views/utils.js.

Part-of: odoo/odoo#110819
Co-authored-by: Mathieu Duckerts-Antoine <dam@dooo.com>
2023-02-14 17:09:05 +01:00
a3dd93194f [IMP] web: introduce useVirtual hook
This commit introduces a hook named "useVirtual" which allows to filter
a given list of objects and return only those that are visible in the
current viewport. This effectively allows to use virtualization in lists.

The hook will trim down the list of objects it received to those that fit
in the current viewport (with a fixed margin above and under to allow
smoother transitions on scroll).

The following requirements must be met to use this feature:

- the scrollable area has a fixed height
- along with the list of items, a "getItemHeight" getter must be
provided to determine the actual height of each individual item;
- the items are rendered with a proper offset inside the scrollable area.
  This can be achieved e.g. with a css grid or an absolute positioning.

Part-of: odoo/odoo#110819
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-02-14 17:09:04 +01:00
Julien Mougenot 48bc5315da [IMP] web: Improve mockCopy and mockServer logging
This commit handles 2 things:

1. bring the mock server "copy" handler closer to its actual
implementation, supporting a second argument which is a dictionnary of
default values to be applied to the copied record;

2. make the mock server debug logs more readable, with a nice color code
(blue for requests, orange for responses) so that debug info are easier
to read in the console.

Part-of: odoo/odoo#110819
Co-authored-by: Julien Mougenot <jum@odoo.com>
2023-02-14 17:09:04 +01:00
Julien MougenotandMathieu Duckerts-Antoine d96b56f670 [IMP] web: Improve mockRead performance
This commit improves the performances of the mock server "read" handler
by reducing the amount of iterations performed on the current set of
records.

This was needed as some tests (namely: gantt manual performance tests)
mocked huge amounts of records and the main bottleneck was the mock
server, while the actual impact was supposed to be measured on the
rendering process.

Part-of: odoo/odoo#110819
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-02-14 17:09:04 +01:00
FrancoisGe 45ef57bedc [REF] web: convert Record.formattedRecord to utils
To evaluate the KanbanRecord and the ActivityRecord, a formattedRecord is passed.

What is a formattedRecord:

Before this commit:
The base record + all its fields with the keys value and raw_value.
formattedRecord = {
    ...Record(),
    field1: {
        value: ...,
        raw_value: ...,
    }
}

After this commit:
All its fields with the value and raw_value keys.
formattedRecord = {
    field1: {
        value: ...,
        raw_value: ...,
    }
}

This modification avoids giving access to the functionality of the Record
class directly in the arch. The arch should never have access to the
internals of the Record.

closes odoo/odoo#112618

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-14 14:37:51 +01:00
FrancoisGe d4c60f233c [IMP] web: aggregate value for displayed columns
The purpose of this commit is to no longer calculate the aggregated
value of columns that are not displayed in the list view.

Before this commit, we always calculated the aggregate value of optional
columns that are hidden.

closes odoo/odoo#112542

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-14 14:37:48 +01:00
Bruno Boi b8b42d5a49 [FIX] web: pivot,graph: usesamplemodel to false
After a model in sample mode has fetched sample data, its orm is reset
to be the "true" orm (standard orm service using the real server (prod)
or the mock server (test)). Thus any change in the view parameters that
imply to fetch data will lead to fetch "true" data (possibly none) and
thus present "true" data in the view. The problem is that the graph and
pivot views did keep the class .o_view_sample_data in that case.
Here, we make sure that that class is removed at an appropriate time.

closes odoo/odoo#112612

X-original-commit: ae6ec8dcfb24b86743e3ee14ae2526b4f8b681b9
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-02-14 13:13:58 +01:00
Aaron Bohy 0639a99a9a [FIX] web: fix typo in X2ManyField props definition
Before this commit, the "addLabel" and "editable" props type was
not really tested.

closes odoo/odoo#112583

X-original-commit: bb060d012ff9dfe07fa75c851feafc0af2bfc0b5
Signed-off-by: Georis François (fge) <fge@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-14 09:00:56 +01:00
Ivan Yelizariev fa60348883 [FIX] web: properly handle error on copying link to clipboard
Promise error cannot be caught by try-catch, because execution doesn't happen
immedialty. Instead, `Promise.catch` must be used.

STEPS:

* Login native app
* Sales -> Quotation -> Open any quotation
* Action Button (cog icon) -> Share
* Click on Copy Button -> a Traceback appeared

opw-3077859

closes odoo/odoo#112584

X-original-commit: 9cdcd1c1f7219030386d2c90205ea083eb835a13
Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-02-13 21:28:11 +01:00
luvi 48b8242d6f [FIX] web: fix placement of add icon in ExportDialog
This commit fixes the placement of the add icon that could be on top
of the next line in the export dialog, when the name of the field was
too long. This overlapping prevented to press the button of the next
line. This is due to a fix made in commit (1). Now, it is correctly
displayed without overlaying, both in ltr and rtl directions.

Also, because there was not enough padding and some browsers are using
overlay scrollbars on top of the buttons, it was in some occasions not
possible to press the buttons, because the scrollbar was covering the
whole area. In the list of fields, only the first level of elements has
the padding, to avoid having a cascade style when unfolding items.

Static props have also been added to the component, as the component was
introduced without them.

(1): https://github.com/odoo/odoo/commit/f10a4886d2c2bfc0d4643e0e4597e62c2ba4f94e

closes odoo/odoo#112570

X-original-commit: 66207b9ffc353bd52993622cc528494b49eedc27
Related: odoo/enterprise#37037
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-02-13 21:28:08 +01:00
Pierre Rousseau ac6db52173 [FIX] web: pivot view: use correct label for headers
Before this revision, the pivot view used the wrong label for the
headers in the case of the group by value was "0". This was due to
the use of the falsy value of the group by value to determine if
the label should be used or if the label should be "Total".

closes odoo/odoo#112571

X-original-commit: 97db8c975643bb79e95f7506da03c7142651a3cf
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2023-02-13 20:13:04 +01:00
Julien (jula) 926d8c6c5d [FIX] web, stock: escape JSON error when downloading report
__Description of the issue:__

When something goes wrong while downloading a report file, a 500 error
is sent as JSON. However the frontend interprets this response as HTML
and then try to parse the text content as JSON.

Most of the time this works, but if the response contains any HTML tags,
like `<lambda>` from a Python stacktrace, the JSON response will get
misinterpreted as HTML instead of regular text, causing the subsequent
JSON interpretation to fail.

The end result for the user is that empty tracebacks will be displayed
instead of User Errors or actual tracebacks.

__Desired behavior:__

The JSON response is HTML escaped before being sent and will therefore
be correctly parsed and displayed to the user.

This basically restore what was done prior of #104594.

Enterprise: odoo/enterprise#36523
X-original-commit: 5999a7d336553053c5638f69344cdfbc84a8c681
Part-of: odoo/odoo#112453
2023-02-12 14:14:41 +01:00
Chong Wang (cwg) e89270551a [FIX] web: show translate button for ir.ui.view
after #111448, the structure of text field is changed. The Translate Button css
hack for ir.ui.view's form view doesn't work.
1. enable the multiple languages
2. go to the form view of a ir.ui.view record
3. the EN button for the view disappears

This commit fixes the bug by adapting the css to the new structure

closes odoo/odoo#112420

X-original-commit: 4dc94998f295b32567472d87bcf7e44af621e4c2
Signed-off-by: Luca Vitali <luvi@odoo.com>
Signed-off-by: Wang Chong (cwg) <cwg@odoo.com>
2023-02-10 15:44:29 +01:00
Christophe Monniez fab86bbf8b [FIX] web: adapt test for werkzeug >= 2.2.2
In werkzeug 2.2.2, the following characters "$!'()*+,;" are now
considered as safe by url_quote. This makes the filename_secure test
fail with the hard coded expected string containing a single quote as
'%27'.

This commit adapt the filename_secure test in order to work with all
versions of werkzeug.

closes odoo/odoo#112298

Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2023-02-10 14:37:31 +01:00
amdi-odoo 79fe1333a0 [FIX] web: fix x2many list overflow
Purpose
=======
Prevent the x2many list tables in notebook
pages to overflow when having long chars in
the cells or sections.

Specifications
==============
Because of the display inline-block css rule
applied to the x2many field widgets, the table
of the x2many list (in the notebook pages) are
overflowing from the box when having long char
in the cells or sections.

Setting width 100% to the x2many field fixes
the overflow behavior. Long chars are hidden
with ellipsis or wrapped and displayed to a
new line depending on the display.

Task-3151054

X-original-commit: 2cd0106e63785dd34553c2b4747d72b93b9a7afd
Part-of: odoo/odoo#112372
2023-02-10 09:11:57 +01:00
Michael (mcm) 50aaf73eea [IMP] web: improve list control panel style
Before this commit, the bottom row of control panel in
list view could change height when reducing window size
and give an ugly layout.
This commit gives more flex to this row to keep a correct
layout when reducing window size.

task 3095775

closes odoo/odoo#110277

Related: odoo/enterprise#36895
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-02-10 09:11:54 +01:00
Jorge Pinna Puissant 58cc5662a9 [FIX] web: kanban view's quick create flickering
Before this commit, when creating a new record using the quick create on
a kanban view, a flickering was visible. We can see the quick create
form disappear, the record list goes up, the quick create form re-appear
and the record list goes down again.

This occurs because, the record list contains an empty record that is
used on the quick create form. When clicking on the add button on the
quick create form, this record is directly saved, and as is already on
the list (the quick create form disappear and the record list goes up),
only after this action, a new empty record is created and added to the
list (the quick create form re-appear and the record list goes down
again).

Now, an empty record is created independently of the list, so when we
click on the add button on the quick create form, the record is saved,
a new empty record is created (the quick create form is emptied), and
the saved record is added to the list (the record list got the new saved
record), avoiding the flickering.

task-id=3085247

closes odoo/odoo#112367

X-original-commit: 9c82f5dca00921b6911671db3845ad593d2e1191
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-02-10 07:16:59 +01:00
Nshimiyimana Sénaandhuvw 1309a8b86c [FIX] web: fix arabic date parsing
# Steps to reproduce
* Have Arabic language installed
* Create an invoice
* Register a partial payment (keep invoice open)
* Switch to Arabic language
* Click the register payment again

=> You should be met with a traceback

# Cause
Currently, the `parseDate` function relies on `parseDateTime`. If no
format is passed to `parseDateTime` (like in our case), the user's
`localization.dateTimeFormat` is used. `parseDateTime` implements
workarounds to allow parsing of dates (without a time).
However, those workarounds do not work with languages such as Arabic.

opw-3133992

closes odoo/odoo#112354

X-original-commit: 869b01da4948775d9a3009426a74cc9207e81374
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
Co-authored-by: huvw <huvw@odoo.com>
2023-02-09 23:09:00 +01:00
Jorge Pinna Puissant a30978b30f [FIX] web: many2x falling quickcreate
Before this commit, if a many2x fall the quickcreate, it will fall back
correctly to the slow create, but it will also raise an error.

Now, the error is not raised anymore.

closes odoo/odoo#112311

X-original-commit: 800e7ab6658b013930e6691cf778bb425da3e723
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-02-09 19:06:51 +01:00
stefanorigano (SRI) f6b2b5e18a [FIX] web: ListRenderer, sticky-header's shadow
Prior to these changes the shadow wasn't rendered on Firefox and Safari.
This commit introduces a pseudo-element that mimics the shadow effect.

Since browsers behave differently when it comes about sticky table's
elements, it's unfortunately not possible to use a simpler approach (eg.
applying a shadow to the <thead> directly).

The commit will also replace raw-CSS with the o-position-sticky() mixin
and provides the CSS hook to handle dark-mode correctly.

original task: task-3126127

task-3141304

closes odoo/odoo#112304

X-original-commit: 108792e29846a6ba944581728702868675208e23
Related: odoo/enterprise#36865
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
2023-02-09 18:07:30 +01:00
Florian VranckxandJulien Castiaux 8c30699f2a [FIX] http: no rotate sid for unidentified user
This commit fixes a change in behavior between 15.2 and 15.3.

Previously, if an unidentified user tried to reach a route that had auth='user', it would simply redirect to the login page.

Currently, it redirects and invalidates the session_id.

This is an issue in the latest version of master after this PR https://github.com/odoo/enterprise/pull/36521
This commit changes the route of service-worker.js to auth='user'.

This route is called on the login page, which rotates the sid and therefore invalidates the csrf token. Making it impossible for a user to log in.

This is a race condition, meaning it would only appear if the user stayed on the login page for a few seconds, hence why the automated testing did not block the commit.

closes odoo/odoo#112239

X-original-commit: d5d80d172616afe02bd41934930ea18dc273c739
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
Co-authored-by: Julien Castiaux <juc@odoo.com>
2023-02-08 21:45:53 +01:00
MerlinGuillaume a021c48417 [FIX] spreadsheet,web: use dot or comma in date format
Date fields are changing format if you type it in instead of using the
date selector calendar popup

Steps to reproduce:
1. Install Time Off
2. Open the current language and change the date format to `%d.%m.%Y`
3. Go to Time Off > Approvals > Allocations
4. Create a new allocation
5. Change the validity period to 10.03.2023 (by typing it in, not using
   the datepicker) and click out of the field
6. The date displayed is changed to 2010/03/20 or 20.03.2010 (if the
   datepicker was opened)

Solution:
Add dot and comma as a possible character for static format
Also deduplicated function isValidStaticFormat so we have a single
definition

Problem:
Formats using dots were not considered as valid static format so the
value entered was parsed with the format `yyyy/MM/dd` instead

opw-3081268

closes odoo/odoo#112218

X-original-commit: 18d6944510b55a4de21be050b8fef327f00e71d5
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2023-02-08 16:50:00 +01:00
Pierre Paridans 4ce90e196d [FIX] web: oe_title + oe_avatar alignment in Form view
This commit fixes a broken selector when an avatar image (`.oe_avatar`)
is used next to a title element (`.oe_title`) to put them side-by-side.

Also it goes beyond that by ensuring the `.oe_title` element doesn't
take the whole width (cf. max 75%) to make a visual distinction between
it and the other form's fields, both in editable and non-editable form.

In small screen, as space is limited, the whole width is kept to make it
more userfriendly, only allowing a thin gap between the `.oe_title` and
the `.oe_avatar`.

Steps to reproduce:
- Open Apps
- Choose an App and, in the dropdown, click on Module Info
=> there is a huge gap at the top of the title

closes odoo/odoo#112205

X-original-commit: 45ebcbf320eaeedf0a4c6c068ea727cf18bedd4b
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-02-08 15:39:03 +01:00
Audric Onockx (auon) d5ddedba35 [FIX] web: display "invite" button label on one line
Settings > General Settings > Section Users:
Button Invite behaves in a weird way.

In dutch, e.g., "Nodig uit" splits into 2 lines,
whereas it could expand, eating out a little bit of the
input's space.

closes odoo/odoo#112192

X-original-commit: fa258ab9e4a608aaeced774bfa32eea1894e324b
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-02-08 13:28:16 +01:00
Aaron Bohy ee3e28987e [REM] web,project: remove legacy data export
This commit remove the legacy implementation of the data export
dialog, which wasn't used since the removal of the legacy list
view. This also allowed us to finally remove the data.js file,
which contained the "legacy legacy" implementation of the model
(DataSetStatic, DataSetSearch...). This was deprecated since v11.

Part of task 3168640

Part-of: odoo/odoo#111809
2023-02-08 13:27:58 +01:00
Aaron Bohy 49297bc7bb [REM] *: remove legacy basic views + some fields/widgets
This commit removes the legacy implementation of the form, kanban
and list views. It also removes the legacy view widget registry,
and all legacy widgets it contained. The legacy field registry
couldn't be removed yet as some fields are still used (e.g. in
client actions: FieldMany2One, FieldMany2ManyTags...), and
sometimes accessed from that registry (e.g. uom service). More
clean up will come later. Note that all tests using legacy views
have thus been removed, even though the tested feature might still
remain (e.g. FieldMany2One tests have been removed, but that field
is still there). However, those features are deprecated and
unlikely to evolve. They should be removed in the next saas, or the
one after.

Finally, this commit also removes the legacy view dialogs.

Task 3168640

Part-of: odoo/odoo#111809
2023-02-08 13:27:58 +01:00
Aaron Bohy c4c7534c0b [REF] web: legacy relationalfields: stop using view dialogs
This commit aims at removing the last usecases of the legacy view
dialogs, which will then allow us to remove legacy basic views.
The last usecases were in legacy code, in FieldMany2Many and
FieldMany2ManyTags. As those fields are still used in client
actions, we adapted them to use the wowl view dialogs instead.

Part of task 3168640

Part-of: odoo/odoo#111809
2023-02-08 13:27:58 +01:00
Aaron Bohy b2e267872f [REM] web: remove legacy views benchmark page
Those views are no longer used and about to be removed. This
commit also removes the benchmark lib as it is no longer used.

Part of task 3168640

Part-of: odoo/odoo#111809
2023-02-08 13:27:57 +01:00
Florian CharlierandJulien Castiaux beaae001f8 [FIX] web,onboarding: fix multiple progress records
and better handle progress requests.

In previous versions, it sometimes occurred that multiple
onboarding_progress records were created despite our measures
against that.

Two problems were identified and fixed here, together with a simple
mean to handle this error on the client-side.

1. `_sql_constraints` entry was not adequate to prevent multiple
  records from being created for onboardings which are not to be
  completed per-company but per database because in our version(s)
  of PostgreSQL `NULL` values cannot be considered `NOT DISTINCT`,
  i.e., all NULL values are different from one another so `UNIQUE`
  is respected when we wouldn't want it.
  Therefore, we implement here a `UNIQUE` index via the model's init,
  allowing to catch unique violations when company_id is not set.

2. While we search if a record exists before creating a new one, it
  could happen that another worker created a record between these
  steps. As the database is configured (`REPEATABLE_READ`, which
  applies until the end of the transaction, when we leave the
  controller), it is very difficult to retrieve the record created by
  the other process. See additional details in the testing part below.
  Therefore, we chose to ask the client to perform a new request if
  desirable.

Existing extra records are removed with the related UPG PR script.

### Tests

Tests are included to make sure it is not possible to create multiple
onboarding_progress records for the same onboarding and company or
without any. This includes a non-standard (runbot will not run it)
and "database breaking" (we try to clean up our mess but we cannot
give any guarantee) concurrent test that reproduce the following
scenario:

The `/onboarding/<string:route_name>` is called twice in two different
workers for a same `route_name`. The corresponding onboarding exists
and has no corresponding `onboarding.progress` record yet. Python side,
the two workers are oblivious of what's happening in the transaction of
the other worker thus any python-side-only unicity constraint would
fail to detect any progress created by other workers. This would end up
with two progress records created for a single onboarding which is
illegal.

Task-3101666

closes odoo/odoo#109221

Related: odoo/upgrade#4142
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Julien Castiaux <juc@odoo.com>
2023-02-08 12:25:52 +01:00
Stefan-Calin Crainiciuc (stcc) d6bab31a94 [FIX] web: add DomainSelector debugValue default value
Steps to reproduce:

- Install Events
- Activate debug mode
- Events > Config > Lead generation > Create

Traceback is raised.

The `debugValue` prop added in a29691bfd8 should be a string but doesn't
have a default value, and it is evaluated as `false` at runtime.

Solution:

Add default value for `debugValue`.

opw-3056391

closes odoo/odoo#112149

X-original-commit: bec8da1dc250a40b77d02bd5f487f12f5a857dde
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2023-02-08 10:18:54 +01:00
fdardenne 1bfc3aa1cf [IMP] web: x2many list: deactivate modal when in editable
Before this commit, in a form view, it was possible to open a record in
a x2many list field when the list is editable (`editable="top|bottom"`)
and the form view or the field is in readonly.

We want to disable the opening of the record in this case to stay
consistant for a better UX:
- when in a editable x2many list, the record form view never opens (even
  if the form view or the field is in readonly)
- when not in editable, the form view always opens

This commit does not modify the behaviour of the x2many field kanban
view.

task-2964320

closes odoo/odoo#110838

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-07 15:35:49 +01:00
Jorge Pinna Puissant 9e14de9491 [FIX] web: update moment.js to 2.19.3
This version of moment.js is required to avoid CVE-2017-18214

task-2291793

closes odoo/odoo#112079

X-original-commit: 11f3e7351a899848ec4df0107c3f6e2a627807ba
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-02-07 13:34:50 +01:00
FrancoisGe 97a641a750 [FIX] web: client action reload
This commit aims to solve two problems:
1. Keeping the hash if no action_id or menu_id is passed as a parameter.
2. Always force a reload of the page.

Description of the issues:
1. When reloading from an action, we just want to force a reload of the
page while staying on the same action. We only want to modify the hash
if we want to reload the page by opening another action.

2. When installing the website module, an error dialog is displayed and
the page is not reloaded because location.assign(...) only causes
a reload when the url has changed (path or search, it ignores the hash).
The error comes from trying to access a client action that is not yet
in the assets. It will be added when the page is reloaded.

Solution:
1. Modify the hash only when you have action_id or menu_id in the action params

2. We have thought of two solutions:
- Do a location.reload(...) when the url has not changed. The error
  appears during the reload time because location.assign(...) modifies
  the hash. The service action will then try to execute the client action
  which does not yet exist. (legacy solution)
- Always have a different url so that location.assign(...) causes a reload.
  So we decided to add/remove the reload key in the url search. This will
  always force a reload. We will opt for this solution because it avoids
  displaying a crash.

closes odoo/odoo#112077

Taskid: 3144132
X-original-commit: 77772c0e73d9f561fed63847175e2dbc9b809fa1
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-07 13:34:45 +01:00
hote c1f8c4abda [IMP] web: add disabled props to CopyButton and CopyClipboard field
The CopyClipboardButton Component acts as a button. As such it is
interesting to add the possibility to make it disabled when needed.
This commit adds the possibility to add the attribute `disabled="1"`
to the xml code and let it function as one should expect.

See task 2672713 for a practical use.

closes odoo/odoo#111724

Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-02-07 12:36:45 +01:00
Michael (mcm) 2309fda2d7 [IMP] web: move calendar filter panel to left
This commit moves the filter panel of the calendar view
to the left of the view to make it more coherent with
other views.

closes odoo/odoo#111666

Task: 3164391
Related: odoo/enterprise#36606
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-02-07 11:41:31 +01:00
Ivan Yelizariev 4862bec68e [FIX] web: fix overlapping of Add, Expand buttons in export wizard
Some html structures are not well mirrored in RTL directions.
Fix it by changing it to rtl frienldy structure.

STEPS:
* switch to any RTL language
* open list view for any model
* click Action -> Export

opw-3063763

closes odoo/odoo#112034

X-original-commit: f10a4886d2c2bfc0d4643e0e4597e62c2ba4f94e
Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-02-06 20:39:42 +01:00
jbw-odoo 4c909c9715 [FIX] web: gray out sample data group lines in list view
Group lines in a list view of sample date should not be clickable.

Before :
Create a new partner and make an invoice for him in 2020. Post it, and open the partner ledger for 2023. The partner appears. If you unfold his line, you'll see the initial balance amount. So far, so good. Now, click on the "journal items" button on the partner line. Since there is no aml in period for him, it shouldn't show any. Indeed, nothing is shown, and the mockup data are displayed ... However, the "group by partner" filter applied on the list view make is so that group lines are displayed for mockup data ... and they are not greyed and not-clickable as they should.

closes odoo/odoo#111467

Task: 3126138
X-original-commit: ca3c9988422dc29ec193af380177e19c8c4f69c1
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) <jbw@odoo.com>
2023-02-06 14:16:37 +01:00
Géry Debongnie a5036864b1 [IMP] web: add a memoized checkAccessRight method on user service
This prevents the property field from calling repeteadly the server for
an information that (almost) never changes. Note that all checks should
probably go through this services for the rest of the codebase.

closes odoo/odoo#111571

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-02-06 12:09:51 +01:00