Commit Graph
288 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
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
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
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) 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
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
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
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
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
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
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
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
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 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
Mathieu Duckerts-AntoineandMichaël Mattiello 1c374b9b05 [IMP] web: Advanced Search
The old submenu "Add Custom Filter" of the menu "Filters" is now replaced
by a menu item "Advanced Search". Click on that item will open an
"Advanced Search" dialog in which the current search domain is displayed
in a domain selector. It is then possible to easily add/remove/edit some
parts of that domain before make a new search with the edited domain.

Task ID: 3269923

Part-of: odoo/odoo#118057
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
2023-04-13 17:57:13 +02:00
Pulinckx Pierre (PIPU) 614de86989 [REF] *: Replace underscore function by native JS
Replace _.isNumber(), _.filter(), _.reject(), _.unique(), _.indexOf(), _.lastIndexOf(), _.findIndex(), _.range()
_.keys(), _.values(), _.str.sprintf() and some _.each()

closes odoo/odoo#118003

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-13 16:40:11 +02:00
Julien Carion (juca) 963f53336b [FIX] web: Remove view_ref keys from context in many2one
This commit ensures that keys ending with _view_ref are properly
removed from context when using create and edit action

opw-3256019

closes odoo/odoo#117471

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-13 03:15:46 +02:00
fdardenne 044f2a9c58 [FIX] web: x2manylist: fix record opening when edit=false editable="bottom"
Steps to reproduce:
- Install appointments
- Log in as Marc Demo
- Go to Calendar/Online appointments
- Click on a record in the availability x2many fields

Current behaviour:
It opens the record in a form modal.

Expected behaviour
It should not open the record since #110838 because the x2manyfield
is in `editable="bottom"`.

closes odoo/odoo#118225

X-original-commit: d4399a87f1ca59389d7e58754b67c3fc816cb25a
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-11 17:53:54 +02:00
Alexandre Kühn e8567dadbd [FIX] web: upload same file twice in discuss composer
Before this commit, when clicking on "Attach files" in discuss
composer, then removing it, it was not possible to upload the same
file again.

This happens because file input of file uploader relies on `change`
from the input. The `input.value` contains the filepath, so if we
upload the exact same file without clearing the value, the value
will be unchanged and it won't trigger uploading as a result.

This commit fixes the issue by clearing the input just after
the file has been uploaded, so that we can upload the same file.

Cannot reproduce bug in QUnit tests because `inputFile` helper
programmatically always trigger "change" on input file.

closes odoo/odoo#117704

Signed-off-by: Luca Vitali <luvi@odoo.com>
2023-04-11 11:33:38 +02:00
Mathieu Duckerts-Antoine d0b9c092bd [IMP] web: new field service
We move the function loadFields from the view service to a newly created
field service. That service can also be used to load model fields for a
given path (loadPath), i.e. load all model fields for the models
traversed by the given path.
We use loadPath in useModelField and DomainSelector.

closes odoo/odoo#117882

Related: odoo/enterprise#39418
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-04-07 19:43:20 +02:00
Pulinckx Pierre (PIPU) 29d55e4403 [REF] *: Replace underscore functions by native JS
Replace _.last, _find, _.extend, _.some, _.every

Taskid 3246238

closes odoo/odoo#117319

Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-04-05 12:50:43 +02:00
Audric Onockx (auon) 399e08fa85 [IMP] web: display progressbar in a different color when > 100%
This improvement will give a visual indication that the progress
has gone over 100% by changing its color.
As, depending on what it measures, it could be positive or negative,
we add an option to the widget to determine the class (color)
that should be used.

task-2909337

Part-of: odoo/odoo#96104
2023-04-03 12:56:46 +02:00
Hubert Van de Walle (huvw) af064c1914 [FIX] web: ImageField size attribute not applied correctly in CSS
Steps to reproduce
==================

- Go to the product page
- Open studio
- Click on the picture and set the size to large
- Save and quit studio
- -> The size doesn't change

Port of https://github.com/odoo/odoo/pull/87087

opw-3217741

closes odoo/odoo#117423

X-original-commit: 63a3466c805c09989e5e022519e1ba450ecb1053
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2023-04-01 17:03:57 +02:00
MerlinGuillaume ae1d574453 [FIX] web: add the same image on different records
Using the same image on new records does not work without refreshing the
page

Steps to reproduce:
1. Install Sales
2. Go to Sales > Products > Products and create a new product
3. Set a name and an image on the product
4. Create a new product (with the 'New' button in the top right of the
   form)
5. Set the image used previously on this product
6. The image does not save

Solution:
Add a `t-key` on the FileUploader in order to recreate a FileUploader
when we open a new form

Problem:
The FileUploader component is not reset when we open a new form (the
files previously uploaded are still present on the FileUploader).
`onFileChange` is thus not called when we use the same image, as the
file hasn't changed.

[This commit] in master fixed the same issue by resetting the
FileUploader after each upload so we can revert it
https://github.com/odoo/odoo/blob/7710c3331ebd22f8396870bd0731f8c1152d9c41/addons/web/static/src/views/fields/file_handler.js#L66

[This commit]:https://github.com/odoo/odoo/commit/18384bb519d95e937ea4cfdd660ac08ba89214c0

opw-3151756

closes odoo/odoo#117252

X-original-commit: 3b04edc80f916b3b02a6abc7e88de32e53593fc2
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-03-31 10:53:10 +02:00
Romain Estievenart fb8112a06b [IMP] mail,hr,web: change the UX of the Many2ManyAvatarFieldPopover
The commit change the design of the Many2ManyAvatarFieldPopover the goal
is to remove the m2m dropdown and fill the dropdown content directly
inside the popover.

It also reverses the order of the displayed tags inside the m2m avatar
field in the kanban view and inside the popover.

It removes the possibility to unassign users on mouse hover in kanban
view.

Note:
It's still possible to remove users inside an m2m_avatar_field popover.

Task ID: 3229888

closes odoo/odoo#117194

X-original-commit: f0d71e98743421318a798ef9d4f1e75d11a23334
Signed-off-by: Michaël Mattiello <mcm@odoo.com>
2023-03-31 10:53:08 +02:00
Julien Banken 88c256d8d8 [FIX] web: standardize behavior for int and float property fields
Currently, the property fields of type integer and decimal does not
behave like the standard fields. There are the following issues:

1. The property fields of type integer and decimal do not fallback to
   the value 0 or 0.0 when the field is emptied.
2. The user can not write the value 0 in the property field of type
   integer and decimal. The value gets discarded whenever the user
   unfocuses the input field.

This commit will fix those two issues and ensure that the property
fields have the same behavior as the standard fields.

task-3226202

closes odoo/odoo#117253

X-original-commit: 08c317743ba90802f471058a8f12d7211f9eb150
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-03-31 09:48:46 +02:00
Michael (mcm) 8da2b52333 [IMP] web: introduce overlay service
This commit adds a new service "overlay" that will be used as a base
for other service which displays a component on foreground like
"popover" or "dialog". The services "popover", "dialog" and "effect"
already uses this new service to have a common container.

The "overlay" service also fix a stacking context issue that could
happen when a popover opened a dialog and this dialog then opened
another popover thanks to the common container.

task id: 3233266

closes odoo/odoo#115308

Related: odoo/enterprise#38786
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-03-30 16:22:51 +02:00
FrancoisGe 6718f001b9 [FIX] web: resequence x2m in dialog form view
Before this commit, in the form view dialog of an x2m, resequencing an
x2m will cause a crash.

Why:
The basic_relatonal_model passes the wrong view type to the basic_model
when resequencing. In this case, we want to use the form view.

How to reproduce:
- Going into a form view with an editable x2m
- Open a record of the x2m in a form view dialog with an x2m containing
  a handle field
- Change the order of the records using the handle field (resequence)

Before this commit:
    A crash is displayed

After this commit:
    The records have been resequenced correctly.

closes odoo/odoo#117145

X-original-commit: 003e6f27db767cd80758b868c8afbf73b78f1abe
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-30 15:09:47 +02:00
FrancoisGe 6371565e69 [FIX] web: many2x fail for a good reason
Before this commit, when the "Create" button of a m2x is clicked and
an error is returned by the server, a form view dialog is opened to
create the record. We want to know if the error is caused by a missing
required field but not by any other type of error.
So we open the form view dialog only if the error is of type
ValidationError otherwise we display an error dialog.

closes odoo/odoo#116954

X-original-commit: 49bae69c602d1587fe159719667ff8dd0fb23984
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-29 11:47:15 +02:00
FrancoisGe a7ed23a41c [FIX] web: decoration on a many2one field
Before this commit, in a list view, the style of a decoration on a m2o
widget was ignored. For example, when applying the danger decoration,
we want the m2o field to be in red.

How to reproduce:

Go to a list view with a field having the many2one widget and
a danger-decoration.
Have a line that respects the decoration condition.
Before this commit:
m2o field text uses its base colour (blue)

After this commit:
m2o field text uses the colour red for danger decoration

closes odoo/odoo#116621

Forward-port-of: #115831
X-original-commit: 9e0eac2
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-29 09:33:38 +02:00
Géry Debongnie 378edfa566 [FIX] web: make notebook tab focusable
Before this commit, the notebook tabs were skipped when navigating with
the keyboard tab or shift+tab keyboard shortcuts. This commit simply
modify the tabindex to 0, so they are not ignored.

Users can now move through the tabs with the tab key, and press enter to
activate a specific tab.

Note that there is not tests because that kind of user interaction cannot
be simulated from the js code

closes odoo/odoo#116874

Task: #2622077
X-original-commit: 1a9a4aef728b406b4c3a1c99cb66e3fc4fd4ff52
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-03-28 23:17:52 +02:00
FrancoisGe 0c9a024110 [FIX] web: m2x_tags_avatar is in edit mode
Since commit 2ecfed335d, m2x_tags_avatar
are based on dynamic.readonly to know if they are readonly or not. This
is a mistake, the only information that depends on dynamic.readonly is
the presence or absence of the popover.
In this commit, we'll set the initial value to readonly and add the
isEditable props that will tell iif you can delete or add records with
the popover.

closes odoo/odoo#116782

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-28 16:44:23 +02:00
Géry Debongnie 3db0ad01a1 [REF] web, *: rework webclient cache invalidation system
The web client has a mechanism to invalidate the action and the view
cache: in the basic model (and the relationalmodel), some code is
looking for updates to some specific models (such as ir.actions) and
trigger a `CLEAR-CACHE` event. This event is then listened by the action
and view services to properly clear the caches.  This mechanism was also
used to reload the page after editing a company, or reloading the
currencies after editing some currency.

With this commit, we modify the orm service to trigger an event after
each rpc. This event can then be used by the action/view service, and
also by the currency/company services to perform their specific cleanup.
This work is one step in the future refactoring of the relational model.

closes odoo/odoo#115655

Related: odoo/enterprise#38814
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-27 16:04:58 +02:00
Mathieu Duckerts-Antoine 6540757d4a [FIX] web: Domain: improve validation
We make the class Domain detect more invalid domains.

closes odoo/odoo#116471

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-03-24 14:37:03 +01:00
Hubert Van de Walle (huvw) 7b368df0fe [FIX] web: binary field filename in form view not updated with pager
Steps to reproduce
==================

- Go to a form view with a binary field, or add one with studio
- Upload a file a.txt to a record
- Upload a file b.txt to another record
- Switch between both records with the pager
- The filename is not updated

opw-3208810

closes odoo/odoo#116323

X-original-commit: 90515916e8adb3edb560d73ec8889ad52319cc1d
Signed-off-by: Luca Vitali <luvi@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2023-03-24 07:44:59 +01:00
FrancoisGe 1c1dcdb676 [FIX] web: properties test very slow
In tests, if we need to interact with dropdowns, we should patch setTimout so that we don't have to wait x ms for the dropdown to open.

closes odoo/odoo#116319

X-original-commit: 008d4faebabbecb88d4ce514650b59cdc21ff85a
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-24 07:44:49 +01:00
FrancoisGe 2ecfed335d [REF] *: extractProps receive dynamicInfo
Before this commit, the use of multiple <field> with the same name in a
view was not well supported.

Why was this?
Some Field components need to know information related to the <field>
such as context, domain, required and readonly. The solution used before
this commit to access this information is to use the getFieldContext,
getFieldDomain, isReadonly, isRequired functions of the model.
Unfortunately, these only take into account the last occurrence of the
<field> because the model is not aware that the same field is present
several times on the view. The information must therefore not come from
the model. For example, it was not possible to have the same field
twice with 2 different domains. It will use the domain of the last
field for both.

Solution:
We will add the object "dynamicInfo" to the fieldInfo passed to the Fields
extractProps function. This object will contain a getter to get the value
of required, readonly, domain and context for the current <field>.
If a Field needs one of its information, it will just have to get it
from extractProps.

Part of Task: 3179751

closes odoo/odoo#115197

Related: odoo/enterprise#38151
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-03-24 01:24:48 +01:00
std-odoo 603df3c890 [FIX] web: allow to use properties in JS domains
Purpose
=======
Allow to use the following domain in views
```
[('properties', '=', [])]
```

To be able to show / hide elements based on the fact that the
properties is empty or not.

Task-3213639

closes odoo/odoo#115990

X-original-commit: 4c41108df23a1bbce8c5f6918ead80568a72d4ce
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2023-03-21 14:32:40 +01:00