odoo/odoo#161466

Created by Romain Derie (rde)
Merged at 5c2db8e7fd921d6d32c55b99cae1a9a5fafdb117

Statuses:

label
odoo-dev:17.0-fix-datepicker-calender-rde
head
27d888384da70fcd93fadcb354b2d7b4ae76d9e9
merged
2 years ago by Quentin Smetz (qsm)
odoo/odoo odoo/enterprise
17.0 #161466
saas-17.1 #165358
saas-17.2 #165379
18.0
saas-18.2
saas-18.3
saas-18.4
19.0
saas-19.1
master #165409 #62635

[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:
- <details><summary>The two datepicker in /my/opportunity when editing the lead to adapt
the "Expected Closing" and "Next Activity Date" fields</summary>

image

</details>
- <details><summary>The website form date(time) input</summary>

image

</details>
- <details><summary>The ecommerce renting product rental period inputs ("from" and "to"
dates) </summary>

image

</details>
- <details><summary>The o_website_sale_daterange_picker snippet</summary>

image

</details>
- <details><summary>The survey date fields</summary>

image

</details>
- ..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(&#34;datetime_picker&#34;, &#34;create&#34;, {
+        const picker = this.call(&#34;datetime_picker&#34;, &#34;create&#34;, {
            // ...
        }).enable();
+        this.el.parentNode.querySelector(&#34;.input-group-text&#34;).addEventListener(&#34;click&#34;, picker.openPicker(0));