summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2017-12-28 12:24:50 +0100
committerNicolas Martinelli <nim-odoo@users.noreply.github.com>2017-12-29 09:20:18 +0100
commit88afd055cfc96f6505eec7547419ad96e37ab28d (patch)
treee411e6fdb161a17fde1a3cebf782c47586ac987c /addons/web/static/src/js/fields
parent0126823f986d163b4a1ecbca75549fdc7367a054 (diff)
[FIX] web: currency digits
- Set the currency rounding to 0.001 (3 digits) - Create an account move - Add an account move line, set an account When switching from edit/read-only mode, the rounding switches from 2 to 3 digits. This is because, in edit mode, the format method is the method of the float widget. Therefore, in this case, the formatting doesn't take into account the currency rounding. To avoid this, we simply use a `noSymbol` flag to avoid adding the currency symbol, while keeping the monetary rounding. opw-800279
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js4
-rw-r--r--addons/web/static/src/js/fields/field_utils.js2
2 files changed, 3 insertions, 3 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js
index 6f4bf1630f8..e823278463a 100644
--- a/addons/web/static/src/js/fields/basic_fields.js
+++ b/addons/web/static/src/js/fields/basic_fields.js
@@ -562,8 +562,8 @@ var FieldMonetary = InputField.extend({
this.tagName = 'div';
this.className += ' o_input';
- // use the formatFloat function in edit
- this.formatType = 'float';
+ // do not display currency symbol in edit
+ this.formatOptions.noSymbol = true;
}
this.formatOptions.currency = this.currency;
diff --git a/addons/web/static/src/js/fields/field_utils.js b/addons/web/static/src/js/fields/field_utils.js
index bca74acc088..932ea997e6a 100644
--- a/addons/web/static/src/js/fields/field_utils.js
+++ b/addons/web/static/src/js/fields/field_utils.js
@@ -290,7 +290,7 @@ function formatMonetary(value, field, options) {
digits: (currency && currency.digits) || options.digits,
});
- if (!currency) {
+ if (!currency || options.noSymbol) {
return formatted_value;
}
if (currency.position === "after") {