odoo/odoo#165409

Created by fw-bot
Merged at ac603052e74d74d9eb543db198fcd5437a5e8a3e

Statuses:

Linked pull requests
label
odoo-dev:master-17.0-fix-datepicker-calender-rde-DXgE-fw
head
7f06d4486e74cb9b94e12bf71ba5cbb0e0b78013
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

[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