summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/field_utils.js
diff options
context:
space:
mode:
authorDavid Monjoie <dmo@odoo.com>2017-07-03 10:47:12 +0200
committerDavid Monjoie <dmo@odoo.com>2017-07-18 15:59:48 +0200
commit1ceb201d5e8221d5fb9e1059bede515a07c577c3 (patch)
treedd1bf81597d83b7348c465cea71ab7843999fcad /addons/web/static/src/js/fields/field_utils.js
parentbce3defc8cd2c0c40e40d7b6cfc58159000ded65 (diff)
[FIX] web: fix boolean fields display in calendar
Since formatBoolean returns a jQuery object, boolean fields were displayed as [Object object] in calendar view. This is a fix for stable version. The real fix would be to get rid of the jQuery object returned by formatBoolean but the change is not trivial.
Diffstat (limited to 'addons/web/static/src/js/fields/field_utils.js')
-rw-r--r--addons/web/static/src/js/fields/field_utils.js14
1 files changed, 11 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 ac4c06454ea..0a44a52e315 100644
--- a/addons/web/static/src/js/fields/field_utils.js
+++ b/addons/web/static/src/js/fields/field_utils.js
@@ -29,12 +29,20 @@ var _t = core._t;
/**
* @todo Really? it returns a jqueryElement... We should try to move this to a
* module with dom helpers functions, such as web.dom, maybe. And replace this
- * with a function that returns a string
+ * with a function that returns a string so we can get rid of the forceString.
*
* @param {boolean} value
- * @returns {jQueryElement}
+ * @param {Object} [field]
+ * a description of the field (note: this parameter is ignored)
+ * @param {Object} [options] additional options
+ * @param {boolean} [options.forceString=false] if true, returns a string
+* representation of the boolean rather than a jQueryElement
+ * @returns {jQueryElement | string}
*/
-function formatBoolean(value) {
+function formatBoolean(value, field, options) {
+ if (options && options.forceString) {
+ return value ? _t('True') : _t('False');
+ }
var $input = $('<input/>', {
type: 'checkbox',
}).prop({