[FIX] website_form: have several date picker
When multiple date (or datetime) pickers are added to a website form,
the uniqueId value is used to differenciate them thanks to 694af9a19a.
It works well in a lot of case (eg. when adding several field at the
same time, or by change because other code consume uniqueId) but in this
scenario:
- add a date field on a form
- save
- add a date field on a form
it is possible have the second field targetting the first one because
they have the same `'datepicket'+uniqueId()` ID. This happens because
uniqueId is reset at each page opening.
found when working on opw-2326882
closes #57092
closes odoo/odoo#57110
X-original-commit: 75ad994a628ef0d994b44cf6e25fd5340c3ecafd
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
@@ -171,7 +171,7 @@
|
||||
<!-- Date Field -->
|
||||
<t t-name="website_form.field_date">
|
||||
<t t-call="website_form.field">
|
||||
<t t-set="datepickerID" t-value="_.uniqueId('datepicker')"/>
|
||||
<t t-set="datepickerID" t-value="'datepicker' + Math.random().toString().substring(2)"/>
|
||||
<div class="s_website_form_date input-group date" t-att-id="datepickerID" data-target-input="nearest">
|
||||
<input
|
||||
type="text"
|
||||
@@ -192,7 +192,7 @@
|
||||
<!-- Datetime Field -->
|
||||
<t t-name="website_form.field_datetime">
|
||||
<t t-call="website_form.field">
|
||||
<t t-set="datetimepickerID" t-value="_.uniqueId('datetimepicker')"/>
|
||||
<t t-set="datetimepickerID" t-value="'datetimepicker' + Math.random().toString().substring(2)"/>
|
||||
<div class="s_website_form_datetime input-group date" t-att-id="datetimepickerID" data-target-input="nearest">
|
||||
<input
|
||||
type="text"
|
||||
|
||||
Reference in New Issue
Block a user