diff options
| author | Géry Debongnie <ged@odoo.com> | 2014-11-12 15:16:55 +0100 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2014-11-12 15:17:20 +0100 |
| commit | 3b700779bc8a66ba145b37458aba383dfd7e1e76 (patch) | |
| tree | 5ef4395db1498edba72a0817a8e71798021a865b /addons/web/static/src/js | |
| parent | 6baca1b49477fbc9bf2cc78b33a9e71860acbc44 (diff) | |
[FIX] prevent crash when searching strings (addon web)
with the switch to moment.js, the way dates are parsed has changed,
and the autocompletion should be adapted to ignore invalid dates.
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/search.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 29f4657b7ea..d2fe8072f40 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1272,8 +1272,9 @@ instance.web.search.DateField = instance.web.search.Field.extend(/** @lends inst return instance.web.date_to_str(facetValue.get('value')); }, complete: function (needle) { - var d = moment(needle).toDate(); - if (!d) { return $.when(null); } + var m = moment(needle); + if (!m.isValid()) { return $.when(null); } + var d = m.toDate(); var date_string = instance.web.format_value(d, this.attrs); var label = _.str.sprintf(_.str.escapeHTML( _t("Search %(field)s at: %(value)s")), { |
