Cédric Krier pushed to branch branch/default at Tryton / Tryton
Commits:
19675c62 by Cédric Krier at 2023-01-25T00:38:36+01:00
Convert empty value as null instead of 0 in Dict numeric fields
Closes #12038
- - - - -
1 changed file:
- sao/src/view/form.js
Changes:
=====================================
sao/src/view/form.js
=====================================
@@ -5190,7 +5190,11 @@
}
},
get_value: function() {
- var value = Number(this.input.val());
+ var value = this.input.val();
+ if (!value && (value !== 0)) {
+ return null;
+ }
+ value = Number(value);
if (isNaN(value)) {
return null;
}
@@ -5213,7 +5217,11 @@
Sao.View.Form.Dict.Numeric = Sao.class_(Sao.View.Form.Dict.Float, {
class_: 'dict-numeric',
get_value: function() {
- var value = new Sao.Decimal(this.input.val());
+ var value = this.input.val();
+ if (!value && (value !== 0)) {
+ return null;
+ }
+ value = new Sao.Decimal(value);
if (isNaN(value.valueOf())) {
return null;
}
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/19675c62ab6ce40063c941c4aa26db297504e009
--
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/19675c62ab6ce40063c941c4aa26db297504e009
You're receiving this email because of your account on foss.heptapod.net.