[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.
This commit is contained in:
parent
f2f4391e8b
commit
1da5d89ba3
|
@ -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();
|
||||
},
|
||||
|
|
|
@ -1673,7 +1673,11 @@
|
|||
<input type="number" class="field_integer" value = "0" step="1"/>
|
||||
</t>
|
||||
<t t-name="SearchView.extended_search.proposition.float">
|
||||
<input type="number" class="field_float" value = "0.0" step="0.01"/>
|
||||
<input class="field_float"
|
||||
t-att-type="widget.decimal_point === '.' ? 'number' : 'text'"
|
||||
t-attf-title="Number using #{widget.decimal_point || '.' } as decimal separator."
|
||||
t-attf-pattern="[0-9]+([\\#{widget.decimal_point || '.' }][0-9]+)?"
|
||||
t-attf-value="0#{widget.decimal_point || '.' }0" step="0.01"/>
|
||||
</t>
|
||||
<t t-name="SearchView.extended_search.proposition.selection">
|
||||
<select>
|
||||
|
|
Loading…
Reference in New Issue