From a5eb720875092c4c10e16d8c0db8226d5a0dc53a Mon Sep 17 00:00:00 2001 From: Adrien Dieudonne Date: Wed, 10 Aug 2016 08:20:18 +0200 Subject: [PATCH] [FIX] web: check if second date exists in search_filters After commit 6739e10, we have two widgets to be able to choose two dates according to the operator (e.g. between). So, the second widget is not always available. 'toString' generates the string to put in the facet and should convert the second date only if the second widget exists. Before this commit, it was not possible to make search filters with only one date because we try to get value of widget that does not exist. --- addons/web/static/src/js/views/search_filters.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views/search_filters.js b/addons/web/static/src/js/views/search_filters.js index bd3edb2168d..8db6288788d 100644 --- a/addons/web/static/src/js/views/search_filters.js +++ b/addons/web/static/src/js/views/search_filters.js @@ -222,7 +222,7 @@ ExtendedSearchProposition.DateTime = ExtendedSearchProposition.Field.extend({ }, toString: function () { var str = formats.format_value(this.get_value(), { type:this.attributes['type'] }); - if (this.datewidget_2.get_value()) { + if (this.datewidget_2 && this.datewidget_2.get_value()) { str += ' and ' + formats.format_value(this.datewidget_2.get_value(), { type:this.attributes['type'] }); } return str;