From 1da5d89ba32526f241b3a0ce82b25a2fa9ee858f Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 30 Apr 2015 13:29:27 +0200 Subject: [PATCH] [FIX] web: advanced search on floats with ',' as decimal separator When using another decimal separator than `.` (dot) in the language settings, it wasn't possible to build an advanced search specifying the decimals. e.g. with a language with decimal separator `,` and thousand separator `.`, if you want to search invoices with amount total 366,38 The advanced search "Total" "is equal to" obliged you to enter your number with `.` as separator (366.38), and then, when entering the search, the `.` was regarded as the thousand separator, giving as domain `('amount_total', '=', 36638)`, which is not what you asked. opw-634201 PS: The `|| '.'` in the xml template are only for retro-compatibility, so if the server sources are updated, but the browser cache is not refreshed (meaning the Javascript code isn't refreshed, and, therefore, `widget.decimal_point is undefined) it still works. --- addons/web/static/src/js/search.js | 4 ++++ addons/web/static/src/xml/base.xml | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 3ac03cf4052..3a3fab3e74c 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -2150,6 +2150,10 @@ instance.web.search.ExtendedSearchProposition.Float = instance.web.search.Extend {value: "∃", text: _lt("is set")}, {value: "∄", text: _lt("is not set")} ], + init: function (parent) { + this._super(parent); + this.decimal_point = instance.web._t.database.parameters.decimal_point; + }, toString: function () { return this.$el.val(); }, diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 13d7e5df080..e9949a589b1 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1673,7 +1673,11 @@ - +