summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2019-05-14 12:18:19 +0000
committerGoffin Simon <sig@odoo.com>2019-05-15 06:36:08 +0000
commit9ed9710b2b9ad685f4f09e42930e212d3cec71e5 (patch)
treebf8cf34b5761198764c100a22aa4eb9d8c299e22 /addons/web/static/src/js
parentc3a81c6c7eebe1c2a42d01ac35f541cefd2c8f0d (diff)
[FIX] web: Error on invalid date format on date field input
Steps to reproduce the bug: - Go to any field Date - Enter wrong date Bug: A traceback was raised. Now a warning is raised and the wrong value is removed. opw:1974747 closes odoo/odoo#33362 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/widgets/date_picker.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/addons/web/static/src/js/widgets/date_picker.js b/addons/web/static/src/js/widgets/date_picker.js
index 57c935905e5..bf5f9623298 100644
--- a/addons/web/static/src/js/widgets/date_picker.js
+++ b/addons/web/static/src/js/widgets/date_picker.js
@@ -13,6 +13,7 @@ var DateWidget = Widget.extend({
type_of_date: "date",
events: {
'change.datetimepicker': 'changeDatetime',
+ 'error.datetimepicker': 'errorDatetime',
'change .o_datepicker_input': 'changeDatetime',
'input input': '_onInput',
'keydown': '_onKeydown',
@@ -104,6 +105,15 @@ var DateWidget = Widget.extend({
}
},
/**
+ * Library clears the wrong date format so just ignore error
+ */
+ errorDatetime: function (e) {
+ if (!e.date.isValid()){
+ this.do_warn(_t("Error"), e.date.toString());
+ }
+ return false;
+ },
+ /**
* Focuses the datepicker input. This function must be called in order to
* prevent 'input' events triggered by the lib to bubble up, and to cause
* unwanted effects (like triggering 'field_changed' events)