[FIX] web search: correct previous fix to properly handle searching for 0 on number fields

Also removed useless HTML escaping and added basic tests.

bzr revid: odo@openerp.com-20130328153502-v71q2m60wh37ganq
This commit is contained in:
Olivier Dony
2013-03-28 16:35:02 +01:00
parent 300d5be0e6
commit 35d61bbd8b
2 changed files with 56 additions and 3 deletions
+3 -3
View File
@@ -1348,9 +1348,9 @@ instance.web.search.CharField = instance.web.search.Field.extend( /** @lends ins
instance.web.search.NumberField = instance.web.search.Field.extend(/** @lends instance.web.search.NumberField# */{
complete: function (value) {
var val = this.parse(value);
if (!val || isNaN(val)) { return $.when(); }
var label = _.str.sprintf(_.str.escapeHTML(
_t("Search %(field)s for: %(value)s")), {
if (isNaN(val)) { return $.when(); }
var label = _.str.sprintf(
_t("Search %(field)s for: %(value)s"), {
field: '<em>' + this.attrs.string + '</em>',
value: '<strong>' + _.str.escapeHTML(value) + '</strong>'});
return $.when([{