odoo icon indicating copy to clipboard operation
odoo copied to clipboard

[FW][FIX] web, *: make "input group date" calendar icon open the date picker

Open fw-bot opened this issue 1 year ago • 5 comments

*: 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

    image

  • The website form date(time) input

    image

  • The ecommerce renting product rental period inputs ("from" and "to" dates)

    image

  • The `o_website_sale_daterange_picker` snippet

    image

  • The survey date fields

    image

  • ..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

fw-bot avatar May 14 '24 12:05 fw-bot

Pull request status dashboard.

robodoo avatar May 14 '24 12:05 robodoo

@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

fw-bot avatar May 14 '24 12:05 fw-bot

Will be adapted

rdeodoo avatar May 14 '24 12:05 rdeodoo

@rdeodoo @qsm-odoo this PR was modified / updated and has become a normal PR. It should be merged the normal way (via @robodoo)

fw-bot avatar May 16 '24 08:05 fw-bot

@qsm-odoo Is this what you had in mind? It's coming with https://github.com/odoo/enterprise/pull/62635

rdeodoo avatar May 16 '24 12:05 rdeodoo

@rdeodoo @qsm-odoo unable to stage: merge conflict

robodoo avatar May 17 '24 20:05 robodoo

@qsm-odoo you may want to rebuild or fix this PR as it has failed CI.

robodoo avatar May 21 '24 09:05 robodoo