odoo/odoo#165379

Created by fw-bot
Merged at f627b249f1912e58ab15864a9f06c0a53b053802

Statuses:

label
odoo-dev:saas-17.2-17.0-fix-datepicker-calender-rde-2X8j-fw
head
c2e02b5419aebfb63977f98c5a7b14ea894a0b98
merged
2 years ago by Romain Derie (rde)
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

[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:
- <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));

Forward-Port-Of: #161466