[FW][FIX] web, *: make "input group date" calendar icon open the date picker
*: website, survey
Since commit 1 the calendar icon in input group date is not clickable anymore and does not open the date picker anymore.
This commit simply restore that by auto discovering the calendar icon, should the input group follow this common pattern:
<div class="input-group date">
<input
type="text"
class="form-control datetimepicker-input"
/>
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
This seems enough to cover all cases detected in the website apps:
-
The two datepicker in /my/opportunity when editing the lead to adapt the "Expected Closing" and "Next Activity Date" fields
-
The website form date(time) input
-
The ecommerce renting product rental period inputs ("from" and "to" dates)
-
The `o_website_sale_daterange_picker` snippet
-
The survey date fields
-
..maybe other places..
Should there be cases needing this feature for calendar icons which are not following the suggested input group layout, they can do it this way:
- this.call("datetime_picker", "create", {
+ const picker = this.call("datetime_picker", "create", {
// ...
}).enable();
+ this.el.parentNode.querySelector(".input-group-text").addEventListener("click", picker.openPicker(0));
Forward-Port-Of: odoo/odoo#161466
@rdeodoo @qsm-odoo this PR targets master and is the last of the forward-port chain containing:
- odoo/odoo#165379
- odoo/odoo#165358
To merge the full chain, use
@fw-bot r+
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
Will be adapted
@rdeodoo @qsm-odoo this PR was modified / updated and has become a normal PR. It should be merged the normal way (via @robodoo)
@qsm-odoo Is this what you had in mind? It's coming with https://github.com/odoo/enterprise/pull/62635
@rdeodoo @qsm-odoo unable to stage: merge conflict
@qsm-odoo you may want to rebuild or fix this PR as it has failed CI.
