diff options
| author | Hardik Prajapati <hap@odoo.com> | 2020-07-01 11:23:31 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2020-07-07 09:17:37 +0000 |
| commit | 8e91b0ad3b1119b69f7a2922d1c61bb9a06529f5 (patch) | |
| tree | 007f16466d1eb9c7217f22eed4faf7150231fb6e /addons/web/static/src/js/fields | |
| parent | d5d79805d2e077c093a378cad8db1591e269305d (diff) | |
[FIX] web: properly display boolean fields in kanban
Before this commit, boolean fields (without widget="boolean") in
kanban views were displayed as [Object object], because when no
widget is specified, we display the (textual) formatted value of
the field. However, the boolean formatter returns by default a
string encoding an html checkbox.
This commit passes the correct option to force a string formatting,
so it now displays "True" or "False". Moreover, this commit
uniformizes formatter options for that purpose, as another option
had been recently introduced for monetary field.
Note that those options should not be necessary, as formatters
should always return text values (no html). But this is a larger
change, that we might do in the future.
Task 2280394
closes odoo/odoo#53937
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/fields')
| -rw-r--r-- | addons/web/static/src/js/fields/field_utils.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/addons/web/static/src/js/fields/field_utils.js b/addons/web/static/src/js/fields/field_utils.js index 4f637994c47..b62a3db7921 100644 --- a/addons/web/static/src/js/fields/field_utils.js +++ b/addons/web/static/src/js/fields/field_utils.js @@ -329,8 +329,8 @@ 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 + * @param {boolean} [options.forceString=false] + * if false, returns a string encoding the html formatted value (with * whitespace encoded as ' ') * @returns {string} */ @@ -338,7 +338,7 @@ function formatMonetary(value, field, options) { if (value === false) { return ""; } - options = Object.assign({ html: true }, options); + options = Object.assign({ forceString: false }, options); var currency = options.currency; if (!currency) { @@ -361,7 +361,7 @@ function formatMonetary(value, field, options) { if (!currency || options.noSymbol) { return formatted_value; } - const ws = options.html ? ' ' : ' '; + const ws = options.forceString ? ' ' : ' '; if (currency.position === "after") { return formatted_value + ws + currency.symbol; } else { |
