documentation/content
Julien Mougenot d1c810739e [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

closes odoo/documentation#4330

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-07-04 01:05:53 +02:00
..
administration [IMP] Administration: Rewrite Upgrade Odoo SaaS 2023-06-30 11:04:07 +02:00
applications [ADD] Inventory: Add Replenish on order (MTO) 2023-07-01 19:07:46 +02:00
contributing [IMP] contributing: change gui abbreviation to lower case 2023-05-24 19:20:17 +02:00
developer [IMP] web: Owl DateTimePicker 2023-07-04 01:05:53 +02:00
legal [FIX] legal: fix broken PDF link 2023-06-19 18:48:18 +02:00
services/support [IMP] Support: Update What can I expect 2023-03-26 09:11:51 +02:00
administration.rst [IMP] upgrade: create new "upgrade" section in "install and maintain" 2021-10-15 11:45:07 +00:00
applications.rst [ADD] attendances: hr and attendances categories + hardware page 2023-03-29 19:20:11 +02:00
contributing.rst [IMP] contributing: list the ways to contribute to Odoo 2022-12-08 15:51:24 +01:00
developer.rst [MOV] developer/cli: move "Command-line interface (CLI)" to the reference dir 2023-02-23 16:09:00 +01:00
index.rst [IMP] *: introduce tables of contents in top-level app pages 2021-07-07 14:56:38 +02:00
last_build.rst [FIX] *: RST cleanup 2023-02-15 16:03:06 +01:00
legal.rst [IMP] documentation: legal page design 2022-12-08 12:31:09 +01:00