NewHighlight of Weekly #001
Date filters can search date ranges
A search view date filter can now name an end field: <filter date="date_start" end_date="date_stop"/>. Its periods then match records that overlap the searched period, not only the ones starting in it. Useful for custom models with start and end dates.
Pull requests and commits
Commit message
[IMP] web: support date ranges in search view filters
A date filter (`<filter date="date_start"/>`) filters on a single field: the
periods it offers, as well as the relative ones introduced in [1], match the
records that *start* in the searched period.
For models describing a range rather than a single date, it is useful to be
able to search for records that are ongoing during a given period.
A date filter can now name the field ending that span:
<filter string="Period" name="period" date="date_start" end_date="date_stop"/>
Its periods and its relative options then match the records overlapping the
searched period:
['&', ('date_start', '<=', period_end),
'|', ('date_stop', '>=', period_start),
'&', ('date_stop', '=', False), ('date_start', '>=', period_start)]
A record with no end date ends when it starts. Each bound is serialized with
the type of the field it is compared to, so that a date field and a datetime
field can be paired.
Task-6546268
[1] https://github.com/odoo/odoo/pull/267980
Related: odoo/enterprise#132421
Related: odoo/documentation#20147