diff options
| author | Aurélien Warnon <awa@odoo.com> | 2019-02-04 07:53:47 +0000 |
|---|---|---|
| committer | Aurélien Warnon <awa@odoo.com> | 2019-02-04 07:53:47 +0000 |
| commit | dcd79a543aa6af7efaad99bbfda567dff8ce6148 (patch) | |
| tree | d69812236cd4d505819fb57c373c5c48fd6f6901 /addons/survey | |
| parent | 13e058c573e8d72b658925ad5807aa47aeff35a0 (diff) | |
[FIX] survey: fix empty date in survey could not be submitted
Purpose
=======
A date field not marked as "mandatory" could not be left blank in the survey.
That was caused by the form returning "Invalid date" instead of an
empty value when submitting.
closes odoo/odoo#30788
Diffstat (limited to 'addons/survey')
| -rw-r--r-- | addons/survey/static/src/js/survey.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/survey/static/src/js/survey.js b/addons/survey/static/src/js/survey.js index 16def6107d2..161f3807e6c 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 = moment(el.value); + var moment_date = el.value !== '' ? moment(el.value) : ''; if (moment_date) { moment_date.toJSON = function () { return this.clone().locale('en').format('YYYY-MM-DD'); |
