Commit Graph
2007 Commits
Author SHA1 Message Date
Pierre Paridans eef262abf4 [FIX] *: adapt QUnit tests and tours
[FIX] *: selectors in tours

[FIX][TMP] account: CogMenu selector in tours

[FIX][TMP] web*: Breadcrumb targetting in tours

Adds a `o_breadcrumb` class to target the whole breadcrumb, no matter
how much elements it contains (collapsed parts, visible path, single
name...).

add classname on last breadcrumb item

[FIX][TMP] project: View buttons selector in tours (moved away from CP)

[FIX][TMP] project: Kanban selectors in tours (quick create)

[FIX][TMP] *: SearchBar selectors in tours (toggle menu)

[FIX][TMP] *: ButtonBox selector in tours

[WIP][IMP] web: add toggleSearchBarMenu in search helpers

adapt and unskip 3 list tests

adapt and unskip calendar tests

unskip web_tour test that actually pass

post rebase fix

allow to lose cell focus after multi edition (given to searchbar) - bug reported, to check later

post rebase fixes

fix

Part-of: odoo/odoo#116641
2023-05-12 22:59:22 +02:00
Brieuc-brd 418413e499 [IMP] web, *: directional icons
This commit adapts the directional icons to improve the usability and
maintain consistency with the ui icons library.

task-2818586

Part-of: odoo/odoo#116641
2023-05-12 22:59:22 +02:00
824024f8aa [REF] web,mail: formView design
- ButtonBox is moved to the ControlPanel's actions section (center).
- StatusBarField, ButtonBox and PercentPieField design.
- Chatter is moved below the ControlPanel (aka "in the view")

task-2818586

Part-of: odoo/odoo#116641
Co-authored-by: Pierre Paridans <app@odoo.com>
Co-authored-by: Pierre Rousseau <pro@odoo.com>
Co-authored-by: luvi <luvi@odoo.com>
2023-05-12 22:59:14 +02:00
stefanorigano (SRI) c964329add [REF] web,account: listView & kanbanView design
task-2818586

Part-of: odoo/odoo#116641
2023-05-12 22:59:14 +02:00
stefanorigano (SRI) f951b72716 [REF] web: inputs, dropdown, popover, tooltips design
task-2818586

Part-of: odoo/odoo#116641
2023-05-12 22:59:13 +02:00
stefanorigano (SRI) ef31306130 [REF] web, mail: badges design
Part-of: odoo/odoo#116641
2023-05-12 22:59:13 +02:00
stefanorigano (SRI) 051ac37232 [IMP] web, * :introduce o_avatar
*: account, gamification, mail, mrp, note, project, website_blog,
   website_event_track.

Uniform design defining a common element shared across different
modules.

task-2818586

Part-of: odoo/odoo#116641
2023-05-12 22:59:12 +02:00
Mathieu Duckerts-Antoine 4e33d82e2f [FIX] web: graph: avoid some useless chart renderings
With a slow network, make a new search in the search bar of a graph view
would lead the graph renderer to be rendered twice. This was due to the
fact that in the graph controller template an arrow function is passed
as a prop to the graph renderer. The reactivity system treats that prop
as changing at each graph controller rendering and ask unnecessarily (in
this case) the graph renderer to render.

closes odoo/odoo#121292

X-original-commit: dab0187e382e5f93dd5ccc78ecbd7e2f47f5c75e
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-05-12 20:52:23 +02:00
Om Rabara b4a2479033 [FIX] web: file uploading state after failed upload
when file uploading is failed that time file uploading state does not change.

sentry - 3957419658

closes odoo/odoo#120818

X-original-commit: https://github.com/odoo/odoo/commit/1493ec2fedf7070882f3497f214f39c862432a2b
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
2023-05-11 18:25:20 +02:00
Julien Mougenot 805197daf9 [IMP] web: Optional start date in daterange fields
Before this commit, the date/datetime/daterange fields only allowed for
an optional end date field. This meant that the primary date was always
the start date.

This commit allows the field to do the opposite: with the primary date
being the end date, and having a `start_date_field` option for an
optional start date.

closes odoo/odoo#120695

Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2023-05-11 09:36:24 +02:00
Julien Mougenot 61414cb8fc [FIX] web: Fix crash in datetime field tests
Before this commit, a test spawning a datetime field in an editable list
view would crash randomly based on the assertion that a datepicker
should not be in the DOM after clicking on that field.

This is wrong however since a click triggers a focus, which is the
condition for the picker to open, althouth this mostly happens after an
additional animation frame because of the way the list works (field
becomes editable on next render -> picker then opens on next render).

This commit adds a nextTick delay after clicking on the cell to restore
the intended behaviour, which is to wait for the picker to open.

closes odoo/odoo#120999

Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-05-10 21:18:16 +02:00
FrancoisGe 21d3b73c2f [FIX] web: change action from a dirty form view
Before this commit, if we try to change the action from a form view
a new record in an x2m and the new action fails to mount, then the new
record in the x2m will always have a virtual id even if it has already
been saved on the server side.

Why:
When you try to exit the form view, the form view will save the record
and not read the record because you leave the view (in the beforeLeave).
But in our case, we fail to mount the new action and so we will stay on
the form view without it doing a read to know the id of the record added
in the x2m. So the view thinks that the x2m still contains a virtual record.

Solution:
Going back to action should rebuild the whole compound. To cause this,
we'll restore the last controller.

How to reproduce:
- Going to a form view with an x2m field and a widget performing a doAction
- Add a line to the x2m
- Click on the widget to change the action
- New action fails to mount, it returns an error
- Close the error dialog
- Edit another field
- Save the form view

Before this commit:
    The new line in the x2m is duplicated.

After this commit:
    The new line in the x2m is unique

opw-3193765

closes odoo/odoo#120765

X-original-commit: 72f68e2
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-05-10 19:17:17 +02:00
Adrien Schoffeniels ece5f26c10 [FIX] web: use copy of fields when using a kanban model
Since commit [1], properties can be displayed in list views. However,
when switching from a kanban view showing the properties to a list view
that should be showing the same properties, these are not shown.

This happens because the model in the kanban controller currently uses a
reference of the fields. When loading the list view, the properties are
thus already in the fields, and they are skipped when trying to apply
them.

This commit solves the issue by working with a copy of the fields in the
kanban controller, as the list controller does since commit [1].

[1]: https://github.com/odoo/odoo/commit/70619d0e6a23f955265c99aa6b25924357e46223

Task-3284508

closes odoo/odoo#120128

X-original-commit: 4ccb018ef1d301d2e52fea05b4949d77049be3ca
Signed-off-by: David Beguin (dbe) <dbe@odoo.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-05-10 13:21:49 +02:00
Julien Carion (juca) 787c6ff32a [FIX] web: Handle access rights in readonly fields
This commit adapts the behavior of all readonly fields
to take access rights into account when deciding whether the field
should be editable or not.
Steps to reproduce: give minimal access rights to Marc Demo user,
log in as Marc Demo, go to crm, make sure no one is assigned as
salesperson in a record and check if the add user icon is available.
Also applies to every kanban view fields (like priority,
many2many_avatar, ...)

opw-3265086

closes odoo/odoo#119818

Signed-off-by: Georis François (fge) <fge@odoo.com>
2023-05-10 13:21:47 +02:00
Kartik Chavda d11cee3474 [FIX] web: add auto save option for state and priority field
Before this commit state selection and priority both
field are saved we change its value even though we
are not saving records and because of that changing
state or priority in sub-task or block-by task
and discarding changes does not set them to their
previous state and it'll create new record without
saving if we change one of those field.

This commit add 'auto_save' option to prevent auto save
on state and priority from sub-task and block-by task
page.

task-3282848

Part-of: odoo/odoo#120925
2023-05-10 11:36:59 +02:00
Hubert Van de Walle (huvw) 5ec18c130d [REV] web: parseMonetary of decimal value without leading 0
This reverts https://github.com/odoo/odoo/commit/59dcd17c2d389d52365a2e2975de800284cd271f

Issue: With a comma as decimal separator, it is replaced by a dot
It is then ignored in parseFloat

closes odoo/odoo#120856

X-original-commit: 83de5424d1fa7013b212dcac9dee66c1cd89269a
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2023-05-09 18:27:07 +02:00
Hubert Van de Walle (huvw) 72646e00e9 [FIX] web: restore orderBy from state when using default order
Steps to reproduce
==================

- Enter debug mode
- Go to "Settings / Technical / User Interface / Views"
- Click on the "View Type" column header
- Click on any record
- Use the breadcrumbs to go back

Issue: the list is not sorted anymore by "View Type"

Cause of the issue
==================

When there is an `orderBy` param passed to `DynamicList`, it takes
precedence over the previous exported state.

We should only use the params.orderBy if it is not the initial one.

Solution
========

In order to know if we are using the initial order by, we need to export
it. With that, we can check if the `params.orderBy` is the initial one.
If it is the same, use the `state.orderBy`
If not, use the `params.orderBy`

opw-3202088

closes odoo/odoo#120839

X-original-commit: 81dba0c1746ba579a01dead8e4712cf83cbaad28
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2023-05-09 07:08:56 +02:00
Hubert Van de Walle (huvw) 7d26f9e4b9 [FIX] web: allow to use the hour:minute on mobile for FloatTimeField
Steps to reproduce
==================

- Use an android phone
- Go to Timesheets
- Click on Add a line
- Click on the Hours Spent input

The keyboard is missing the colon `:` symbol

It is then only possible the enter a time in the float format.

Cause of the issue
==================

The inputmode=decimal attribute prevents a user from entering a `:`
symbol

Note that this doesn't happen on IOS, since the inputmode is ignored for
other reasons.

opw-3278089

closes odoo/odoo#120824

X-original-commit: 8b919ae51d7deb34169b7c6970964056ef2eb632
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2023-05-09 07:08:51 +02:00
Hubert Van de Walle (huvw) 67606c7571 [FIX] web: disable limit for grouped kanban views
Steps to reproduce
==================

- Go to a kanban view with lots of records, for example products
- Remove any filter and group by name

There is only 80 groups, and there is no way to get the next ones

Cause of the issue
==================

The `web_read_group` uses a limit, by default of 80

Solution
========

For kanban grouped views, we don't want to set a limit on the groups

opw-3283004

closes odoo/odoo#120758

X-original-commit: bf772181933ce5334da35c8368455963b2478399
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2023-05-09 06:07:25 +02:00
Mathieu Duckerts-AntoineandMichaël Mattiello c1436ba8ca [IMP] *: advanced search
We allow edition/creation of domains with a domain selector via the
search bar facets or the menu "Add Custom Filter".
The domain selector has also been improved and now support expressions
and a new operator "between" for some field types (those for which <=
and >= are valid operators). We also improve the support of the connector
not.

Task ID: 3063564

closes odoo/odoo#112326

Related: odoo/enterprise#37715
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
2023-05-08 15:18:03 +02:00
Hubert Van de Walle (huvw) 1931f097d9 [FIX] web: parseMonetary of decimal value without leading 0
Steps to reproduce
==================

- Open a product form view
- Enter .5 in the Cost field

It is parsed as 5 but it should be 0.5

Cause of the issue
==================

When trying to strip the currency symbol from the input, the leading
decimal separator was also removed

Solution
========

Adapt the regex by adding the decimal separator in the list of
characters to not exclude

For that, we first need to replace the decimal by a dot as it could be multiple
characters long. (The same is done in `parseNumber`)

opw-3270039

closes odoo/odoo#120693

X-original-commit: 59dcd17c2d389d52365a2e2975de800284cd271f
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2023-05-05 18:08:15 +02:00
b5794e89e1 [IMP] web: Owl DateTimePicker
This commit introduces a date picker OWL component meant to handle the
following use-cases:
- date picker
- date & time picker
- date range picker
- date & time range picker

Basically, this component is the union of the two previous third-party
libraries handling these cases: TempusDominus and DateRangePicker.

New components introduced:

* The main addition of this commit is the `DateTimePicker` itself which
handles the display and interactions of the calendar and time pickers.
> see @web/core/datetime/datetime_picker

* The picker can then be coupled to an input using the
`useDateTimePicker` hook. The purpose of this hook is to handle events
on a given input element and syncronize its value to a date picker it
will spawn in a popover.
> see @web/core/datetime/datetime_hook

* Lastly, a simple `DateTimeInput` component will render an input and
call the hook mentioned above to handle it. This component is
effectively replacing the previous DatePicker and DateTimePicker
components (note that it does not handle range values).
> see @web/core/datetime/datetime_input

Another noticeable change of this commit is the definition of daterange
fields in views:

- Previously, the arch would have to define both fields
and bind them via their options, while also adding an arrow between
inputs or other forms of connection.

- In the new implementation, only the start date field must be declared,
and a date range can be spawned by providing an `end_date_field` in its
options.

Example:
```xml
<field
    name="start_datetime"
    widget="daterange"
    options="{'end_date_field': 'end_datetime'}"
/>
```

warning Added limitations:

- this new way of declaring date ranges means that templates have been
revised to declare one field tag instead of two. This means that list
views using date ranges have lost the ability to be sorted on their end
date fields.

> Justification: the current use cases have been reviewed and it has
been decided that it was not needed to sort on the end date on the
affected list views.

> Workaround: drop the date range and declare both fields as simple date
pickers (i.e. without the end_date_field option).

- all modifiers applied to a field using a date range will be copied and
applied to the end date field. There is no way to define modifiers
specific to one field or the other.

> Justification: there was no use case where one of the two fields
needed specific modifiers.

> Workaround: same as the previous point: split the range into 2 simple
date picker fields.

Additional notes:

- the widget="daterange" is not mandatory in form views, but is required
in list views because only fields with explicit widgets will not be
rendered as simple <span> elements. The date range feature will be
available as soon as an end_date_field is specified.

- as the end date field is not explicitly defined in the view anymore,
any modifier depending on it need to have it defined as invisible
somewhere in the arch.

Task ID: 3121497

Part-of: odoo/odoo#112171
Co-authored-by: Julien Carion <juca@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Pierre Pulinckx <pipu@odoo.com>
2023-05-05 13:52:22 +02:00
Julien Mougenot 6a6a1efbe2 [IMP] web: Popover closes on escape
This commit adds a global listener from the popover controller to close
itself when "Escape" is pressed.

Part of task 3121497

Part-of: odoo/odoo#112171
2023-05-05 13:52:21 +02:00
Julien Mougenot 7874bf3fc1 [IMP] web: Function fieldDependencies + utils doc
This commit does the following in the Web module utilities:

- makes the `fieldDependencies` property of the field objects
definitions a function instead of a list of strings: this makes it
possible for fields to extract their dependencies based on the fields
info from the arch;

- adds/improves types and documentation for some utility functions.

Part of task 3121497

Part-of: odoo/odoo#112171
2023-05-05 13:52:21 +02:00
FrancoisGe 33eeef69f1 [IMP] web: handle before/after saved Record
This commit adds to the Record Component, the possibility to pass
the onWillSaveRecord/onRecordSaved props that will be
triggered before the save of the Record and after it respectively.

closes odoo/odoo#120448

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2023-05-03 17:25:01 +02:00
Pierre Rousseau a449b05221 [FIX] web: allow to disable autosave on boolean toggle
Since https://github.com/odoo/odoo/commit/28e6b7eb83e4309c4e70974d947194bdca240865, the boolean toggle widget
trigger a save when the user clicks on it. This is a problem when the
widget is used in a form view opened from a o2m list, because the
record updated is saved immediately, even if the user clicks on the
discard button.

This commit adds a new option to disable the autosave on the boolean
toggle widget. To disable the autosave, add `autosave: false` in the
options on the field definition.

Task-id 3235962

closes odoo/odoo#120000

X-original-commit: b56e58dff3258698dbbf173bc6790a35a47131b0
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-28 07:54:26 +02:00
Laurent Smet 10c46e2e76 [FIX] web: Add minimal support to x2many for relational_model
Suppose a RelationalModel instanciating a record.
On this record, trigger an onchange adding a new line on a one2many field.
=> The values of the Command.create command is not parsed correctly.

Indeed, if your one2many contains a Date field, its value will be a string and
not a Datetime object as expected.

closes odoo/odoo#119928

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-28 07:54:23 +02:00
damr 7b306edd0b [FIX] web: fix the arrow key navigation in the kanban view
Before this commit, when the user selects a kanban card with the arrows
key navigation in the project/task kanban view, the focus will be on the
first `button/a` element found in the kanban card and so it could be
something else then the classic global click (when the user clicks on
kanban card).

This commit changes the focus to first select the element containing
`oe_kanban_global_click` to click on. If no 'oe_kanban_global_click' is
found, the focus fall back on the previous priorities.

task-3254564

closes odoo/odoo#119960

X-original-commit: 53a1061724faf9797e1301f93fdd708640313fc5
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-27 16:10:44 +02:00
Bruno Boi f22961ad07 [FIX] web,*: repair root class attr
*: web + adaptations in base, fleet, hr, hr_expense, hr_recruitment,
   loyalty, lunch, mail, mass_mailing, note, project, stock, survey,
   web_tour

**Foreword**
Since d19037e141 the rootnode class attribute for form/list views was
copied two times:
- on the o_view_controller div
- and on the root node of the view renderer.

Examples:

<form class="foo">...</form>

    gives

<div class="o_view_controller o_form_view foo">
    <div class="o_control_panel">...</div>
    <div class="o_content">
        <div class="foo o_form_editable ...">...</div>
    </div>
</div>

and

<list class="foo">...</list>

    gives

<div class="o_view_controller o_list_view foo">
    <div class="o_control_panel">...</div>
    <div class="o_content">
        <div class="o_list_renderer foo ...">...</div>
    </div>
</div>

**Issue**
This could lead to confusion and also unexpected styling issues.
See this PR #119815 to read a message JS Framework team has received.
See also another a fix that had to be made for x2m fields: 980244fa8

**Introduced Changes**
- in the form compiler, the root node attributes are no more copied to
  the root div node of the compiled template the form renderer receives
- the root div node generated by the form compiler now has the
  "o_form_renderer" class, which was removed during the recent form view
  refactoring.
- the list renderer no more adds the root node class attribute to its
  "o_list_renderer" div
- the X2ManyFieldDialog has been adapted too
- since View, X2ManyField & X2ManyFieldDialog both need to compute view
  classnames derivated from the arch root node, an util has been
  introduced to avoid duplicating code
- the whole codebase has been checked and adapted.

Related: odoo/enterprise#40418
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2023-04-27 16:10:30 +02:00
Julien Carion (juca) eaacaf122d [IMP] web, *: Add autoresize hooks
This commit adds two autoresize hooks for text inputs and textareas to
make it adapt their size (width for text inputs, height for textareas)
depending on their content.
The commit therefore solves the issue of several form view task titles
being restricted to 1 line while it can be annoying if the title is too
long. The autoresizeTextarea feature was moved from TextField to the
autoresizeTextarea hook and the autoresizeInput feature was moved from
the AutoresizeInput mail component to the autoresizeInput hook.
The TextField component has a new option for disabling linebreaks.

task-3138826

closes odoo/odoo#117355

Related: odoo/enterprise#39493
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-25 14:07:15 +02:00
Bastien Fafchamps (bafa) bacd02f91a [IMP] web: Make AceField use the CodeEditor component
Before this commit:
The AceField component used the ace library to provide the user a code
editing field

After this commit:
The AceField component is now using the CodeEditor component and the usage
of the ace editor lib is now abstracted behind the component.

closes odoo/odoo#117782

Related: odoo/enterprise#39365
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-25 12:57:45 +02:00
Julien Carion (juca) 761d39658e [FIX] web: Format fields with rawAttrs in kanban
This commit makes sure that fields without widget
in kanban are properly formatted using the rawAttrs.

Steps to reproduce: create a float kanban field without
widget, set the digits to anything other than default and
see if the digits attrs are applied to the field.

opw-3263583

closes odoo/odoo#119161

X-original-commit: 1e635154654efcea59fe1f8bae679fb6bac41809
Signed-off-by: Géry Debongnie <ged@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-24 16:57:46 +02:00
Mathieu Duckerts-Antoine bf2cc8d7d1 [FIX] web: SampleServer: many2many in mockReadGroup
closes odoo/odoo#119350

X-original-commit: e63f8206e9658c517743966bb9e24d110fa43508
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-22 05:52:16 +02:00
Aaron Bohy e8b75e4d99 [FIX] web: multi edit list: crash after validating with ENTER
Have a multi edit list view, select several records and edit a
field represented by an input (e.g. a char field). After typing the
new value, press ENTER to validate. The confirmation dialog opens,
click on OK/Confirm to save. Before this commit, an error was
thrown afterwards, because we tried to retrieve the value from the
input, but the input doesn't exist anymore as the edited row has
already been switched back to readonly. This commit fixes the
issue.

closes odoo/odoo#119082

Related: odoo/enterprise#40012
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-21 23:46:11 +02:00
Aaron Bohy 105299eb1d [REF] web: move list specific logic about multi edit
The primary goal of this commit is to simplify the RelationalModel
API, and in particular to remove its "fieldNodes" param, which was
only necessary for a list specific usecase, which is the opening of
the ListConfirmationDialog when multi editing. We also remove the
"blockUpdate" logic from the model s.t. it remains local to the
list controller. About this logic, we fix a minor issue as we no
longer open the "No valid record to save" dialog when the mousedown
event is trigerred on "Discard" (we instead wait for the mouseup,
like already done to open the multi save confirmation dialog).

Part of task 3179751

Part-of: odoo/odoo#119082
2023-04-21 23:46:11 +02:00
FrancoisGe 1b0b0edb3f [FIX] web: Kanban move column and record
In the commit a2342f636c, we wanted to
use isFieldReadonly to find out if the groupField field was readonly or
not. Unfortunately, this function was not suitable for this use case.
IsFieldReadonly only works on a record and not on a list. It was a
mistake to move this function to the Datapoint.

In this commit, we will put IsFieldReadonly back in the Record and
not use it to know if the field of the groupField is readonly or not.
As in the past, we will consider that a field is readonly
if its modifiers.readonly is true (we cannot take into account the
expressions to be evaluated because the record is not accessible).

How to reproduce:
Go to a kanban view group on a field with an "attrs={readonly: [...]}

Before this commit:
The view will crash.

After this commit:
No errors occur.

closes odoo/odoo#119144

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-21 15:02:17 +02:00
Mathieu Duckerts-Antoine d8e08067d4 [IMP] web: sample server: add test file
The new SampleServer class was introduced in c67b9f9907
without dedicated tests. We fix this oversight.

closes odoo/odoo#119188

X-original-commit: 693f7bd74066fa9854db4ecef751f13ec5c7e7a6
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-20 15:21:55 +02:00
Pulinckx Pierre (PIPU) 608e90e998 [REF] *: Replace underscore functions by native JS
Replace _.map(), _.flatten(), _.delay(), _.contains(), _.pluck(), _.isUndefined(), _.isEmpty(), _.isString(), _.isEqual(), _.isBoolean(), _.memoize(), _.invoke(), _.bind(), _.escape(), _.debounce(),
_.str.sprintf(), _.str.repeat(), _.str.startswith(), _.str.trim(),
_.str.escapeHTML(), _.str.escapeRegExp(), _.str.startsWith(), _.str.include()

closes odoo/odoo#118012

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2023-04-20 11:57:29 +02:00
Jorge Pinna Puissant 95c7031027 [FIX] web: kanban: read more is briefly shown when quick create
Before this commit, when quick creating a new record in a kanban view,
the "read more" button is briefly shown (flickering). This issue occurs
because, when creating a new record, we increment the number of records
in the group before adding the record to the list of displayed records.
This means that for a brief moment the number of records of the group is
bigger than the number of displayed records, therefore the "load more"
button is show.

Note that this flickering was introduced due to the following
refactoring : https://github.com/odoo/odoo/commit/067bcac53336b5f66f695b1c10b333d8c722225d

Now, we increment the number of records on the group after we added the
record to the displayed records' list.

closes odoo/odoo#119142

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-20 10:52:06 +02:00
Mathieu Duckerts-AntoineandMichaël Mattiello ebf646b44f [IMP] *: ModelFieldSelector improvements
We refactor the ModelFieldSelector and ModelFieldSelectorPopover
components.

We also improve a bit ModelFieldSelectorPopover:
    - on first page, the button to go back is no longer available
      (so that it is now more difficult to produce an invalid path)
    - we always start with a page presenting the model where the last
      selected field name belongs to
    - the keyboard navigation is improved
    - click on model field selector opens the popover with the focus in
      the search input (if any)
    - for relational fields in popover: the user can either click on the
      relational field (and select it) or a special button that make him
      follow the relation to the field comodel

We also refactor the hook useDynamicPlaceholder to make it use a new
component DynamicPlaceholderPopover that uses ModelFieldSelectorPopover.

Task ID: 3272798

closes odoo/odoo#117951

Related: odoo/enterprise#39673
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
2023-04-19 21:58:34 +02:00
Julien Carion (juca) e96566e11d [FIX] web: Fix computation of aggregates in list_renderer
This commit fixes how monetary fields are handled when doing aggregates in list view:
aggregates should not be computed when all values are not in the same currency and
the currency should be displayed with the aggregate when this is not the case.

closes odoo/odoo#116556

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-19 12:13:22 +02:00
Ipsita Borisagar b2103b06f7 [FIX] base, web: allow reading property fields when no access to parent record
This commit fixes a use case where a user would not be able to access the
property field values of a record because he did not have access to that
record's parent (from the property field definition configuration).

In a concrete example:
- In the Knowledge App
- Marc Demo has access to the "Article B".
- The parent article of "Article B" is "Article A".
- Marc Demo does not have access to "Article A".
- Article B has some property fields values configured.
- If Marc Demo tries to open "Article B" -> crash

This is caused by the framework having to read the property definition from the
parent record, which we don't have access to.
A "sudo" was added to allow that use case (which is supported).

In addition, this commit also adds further checks on the web client side to
gracefully handle a special use case where the end-user could not write on the
parent record because of record rules.
(It only checked *access rules*).

To avoid making an extra RPC every time we load the record (to check if we can
write on the parent), we only make that check when the user tries to modify
(add/edit/remove) a property and show a proper error message.
(This also applies when creating new property field tags).

Task-3062064

closes odoo/odoo#118929

X-original-commit: bc538f6944461a642bac0f757ec96d7f8cc14c9a
Related: odoo/enterprise#39946
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-04-18 19:29:03 +02:00
luvi 99ac5eafc7 [FIX] web: improve search in ExportDialog
This commits aims to improve the search feature in the export dialog.
Now, the search isn't resetted when a field is added to the export list
anymore. It is also possible to search in the list of fields using the
technical name of the field.

A test has been added for the search feature in debug mode, and another
one has been adapted to verify that the search input still contains the
string previously entered.

task-3266632

closes odoo/odoo#118767

X-original-commit: 83e58a0e7e1a6f50ad03a098829946d56393d496
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-17 15:19:03 +02:00
luvi d5c38635ed [FIX] web: improve export dialog fields search
This commit fixes the search feature of the export dialog. Before this
commit, it was impossible to display subfields that would match the
search pattern, since the filter was only applied to look for fields
at the 'root' of the available fields.

Now, it is possible to search and find subfields that matches the
pattern, and they are displayed inside their expanded parent(s).

A test has been added and verify the search feature.

task-3245492

X-original-commit: cd581aa41874dadb5c87605ed49b105959f1b222
Part-of: odoo/odoo#118767
2023-04-17 15:19:03 +02:00
Hubert Van de Walle (huvw)andFrancoisGe 671d96d118 [FIX] web: pressing tab quickly with slow network responses
Steps to reproduce
==================

- With the Chrome devtools, add a network delay of 1 second
- Go to Purchase
- Create RFQ
- Add vendor
- Add products and navigate by using the 'TAB' key
- Add another product line
- Repeat process quickly

`this.list.editedRecord is null`

Cause of the issue
==================

Order of events:
- First tab pressed
- onchange_1 triggered
- Second tab pressed
- onchange_2 triggered
- onchange_1 resolves
- The editedRecord is switched to readonly
- onchange_2 resolves
- There is no more editedRecord

opw-3115650

closes odoo/odoo#118760

X-original-commit: af5cedf078b439710e8801374ace524de54f3b66
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
Co-authored-by: FrancoisGe <fge@odoo.com>
2023-04-17 14:14:27 +02:00
Leonardo Pavan Rocha 823cbdf7e6 [IMP] calendar: rework quick create form view
This commit consists of a full rework of the quick create form in the calendar
view, so that it shows more options to the user rather than only the name of
the event. To accomplish this, we added a new attribute on the calendar view
with the id of the quick create form view to be used. This allows us to have
a custom view to be shown on quick create.

task-3129030

closes odoo/odoo#114827

Signed-off-by: Leonardo Pavan Rocha <lpr@odoo.com>
2023-04-14 18:43:34 +02:00
Bruno Boi 2772dae476 [FIX] web: fix traceback in useDynamicPlaceholder
**Before this commit**
Since 394f85c954f anytime this hook opens a popover, a traceback occurs.
It is due to the fact this hook passes a callback as a
getter-only property to the usePopover hook options.
The traceback occur because the usePopover
hook has to reassign this  option (onClose callback).

**After this commit**
Fixed and tested.

closes odoo/odoo#118580

Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2023-04-14 16:33:49 +02:00
Julien Carion (juca) 1f6c655cbc [IMP] web, *: Add lazy loading for images in kanban
This commit adds the loading="lazy" attribute to every img tags compiled
by the kanban compiler and modifies some kanban archs in order to use
img tags instead of divs with background-image style to load images
(this allows again the loading="lazy" attribute to work).
The purpose is to avoid loading images that are outside the user viewport
at all time in order to reduce the load on the network when new images are
loaded.
Steps to test: find all views that are using the o_kanban_image or o_kanban_image_fill_left
class and ensure all the images in these views appear in the network tab of devtools
when they enter the user viewport. Example: res.partners, hr.employee, ...

task-3102207

closes odoo/odoo#117049

Related: odoo/enterprise#39560
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-14 15:05:56 +02:00
Julien Banken 9dc4b2b438 [FIX] web: reload Many2XAutocomplete component when updating props
Currently, the Many2XAutocomplete component is not reactive: The component
gets the model to load from its props and the component uses a hook to
initialize and open a SelectCreateDialog dialog for that model. The issue
is that the name of the model is copied and set in the setup function of
the Many2XAutocomplete component. When the model changes, the function
opening the SelectCreateDialog dialog is not updated and will hence still
use the name set initially.

Steps to reproduce the issue:
1. Create a new property field of type Many2one or Many2many
2. Choose a model
3. Click on the "Default Value" field
4. Click on the "Search More..." link from the dropdown
5. Choose another model
6. Click on the "Default Value" field
7. Click on the "Search More..." link from the dropdown
=> The modal displays records from the first model picked.

To fix the issue, we will simply put a `t-key` attribute on the component.
The component will then be reloaded whenever the given key changes. The
model loaded by the SelectCreateDialog dialog will then be updated properly
whenever the given model changes.

task-3192917

closes odoo/odoo#118505

X-original-commit: e9fcc1c950129cdb253df3df2ed7197e3de55fd3
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
Signed-off-by: Banken Julien (jbn) <jbn@odoo.com>
2023-04-14 10:45:01 +02:00
Mathieu Duckerts-AntoineandMichaël Mattiello b307e360be [IMP] web: DomainSelector improvements
The objective of this commit is twofold:

- improve the style of the DomainSelector component, in particular, the
  style of the control buttons "Add node", "Add branch", and "Delete node".

- add the possibility to reset the domain when the current domain is not
  supported. The debug input is also always visible in that case
  if the debug mode is active. It is displayed in readonly iff the
  corresponding DomainSelector prop is set to true.

Task ID: 3269923

closes odoo/odoo#118057

Related: odoo/enterprise#39512
Signed-off-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
2023-04-13 17:57:14 +02:00