summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorVictor Feyens <vfe@odoo.com>2020-06-05 13:22:27 +0000
committerAaron Bohy <aab@odoo.com>2020-06-22 09:07:21 +0000
commit7f21258d39053a398ef8b1fed3039b879346f65a (patch)
tree582c222db0c9e85fadbc3f0336dd328c5eea5f07 /addons/web/static/src/js/fields
parent1c856c779b5bc6f22a864ad696c98f4eeb7a7403 (diff)
[FIX] web: kanban: format monetary w/o widget
Before this commit, monetary fields occurring in kanban views without widget="monetary" specified weren't correctly formatted: the whitespace separating the value from the currency symbol was formatted has $nbsp; (html) instead of a simple whitespace. closes odoo/odoo#52521 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/field_utils.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/addons/web/static/src/js/fields/field_utils.js b/addons/web/static/src/js/fields/field_utils.js
index 681a1eb3672..4f637994c47 100644
--- a/addons/web/static/src/js/fields/field_utils.js
+++ b/addons/web/static/src/js/fields/field_utils.js
@@ -329,13 +329,16 @@ function formatX2Many(value) {
* the number of digits that should be used, instead of the default
* digits precision in the field. Note: if the currency defines a
* precision, the currency's one is used.
+ * @param {boolean} [options.html=true]
+ * if true, returns a string encoding the html formatted value (with
+ * whitespace encoded as '&nbsp;')
* @returns {string}
*/
function formatMonetary(value, field, options) {
if (value === false) {
return "";
}
- options = options || {};
+ options = Object.assign({ html: true }, options);
var currency = options.currency;
if (!currency) {
@@ -358,10 +361,11 @@ function formatMonetary(value, field, options) {
if (!currency || options.noSymbol) {
return formatted_value;
}
+ const ws = options.html ? '&nbsp;' : ' ';
if (currency.position === "after") {
- return formatted_value += '&nbsp;' + currency.symbol;
+ return formatted_value + ws + currency.symbol;
} else {
- return currency.symbol + '&nbsp;' + formatted_value;
+ return currency.symbol + ws + formatted_value;
}
}
/**