summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlen-odoo <len@odoo.com>2018-10-05 11:28:48 +0000
committerlen-odoo <len@odoo.com>2018-10-05 11:28:50 +0000
commita034a17d37b7018e48cd2dd5726b4c8c7cb41cee (patch)
treedf055cb08ae8c563d093c9ed1abd50fd7e4cc578
parenta9ce28bfb1fe2bb3087d44e912ec2b39785ab76f (diff)
[FIX] survey: fix date picker template and validation
The date picker widget was set to text instead of date. Then we needed to fix the date validation at form submit. opw 1890130 closes odoo/odoo#27448
-rw-r--r--addons/survey/static/src/js/survey.js2
-rw-r--r--addons/survey/views/survey_templates.xml2
2 files changed, 2 insertions, 2 deletions
diff --git a/addons/survey/static/src/js/survey.js b/addons/survey/static/src/js/survey.js
index eb8f451aa39..145005790ec 100644
--- a/addons/survey/static/src/js/survey.js
+++ b/addons/survey/static/src/js/survey.js
@@ -134,7 +134,7 @@ if(!the_form.length) {
var date_fields = $form.find('div.date > input.form-control');
for (var i=0; i < date_fields.length; i++) {
var el = date_fields[i];
- var moment_date = $(el).data('DateTimePicker').date();
+ var moment_date = moment(el.value);
if (moment_date) {
moment_date.toJSON = function () {
return this.clone().locale('en').format('YYYY-MM-DD');
diff --git a/addons/survey/views/survey_templates.xml b/addons/survey/views/survey_templates.xml
index 76d16e38041..131c5c75a60 100644
--- a/addons/survey/views/survey_templates.xml
+++ b/addons/survey/views/survey_templates.xml
@@ -238,7 +238,7 @@
<template id="date" name="Date box">
<div class='input-group date'>
- <input type="text" date="true" class="form-control date" t-att-name="prefix"/>
+ <input type="date" class="form-control" t-att-name="prefix"/>
</div>
</template>