summaryrefslogtreecommitdiff
path: root/addons/website_form
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2020-09-04 12:13:16 +0000
committerNicolas Lempereur <nle@odoo.com>2020-09-04 15:11:41 +0000
commit3783654b87851bdeb11e32da78bb5b62865b869a (patch)
tree292cd1bc65f5c1e63d0b417bb0f8dddd028f3ed4 /addons/website_form
parent24b0b6f07f65b6151d1d06150e376320a44fd20a (diff)
[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#57109 X-original-commit: 75ad994a628ef0d994b44cf6e25fd5340c3ecafd Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Diffstat (limited to 'addons/website_form')
-rw-r--r--addons/website_form/static/src/xml/website_form_editor.xml4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/website_form/static/src/xml/website_form_editor.xml b/addons/website_form/static/src/xml/website_form_editor.xml
index 4978d0fbb84..1450fb8ccc9 100644
--- a/addons/website_form/static/src/xml/website_form_editor.xml
+++ b/addons/website_form/static/src/xml/website_form_editor.xml
@@ -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"