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 = $('', { type: 'checkbox', }).prop({ diff --git a/addons/web/static/src/js/views/calendar/calendar_renderer.js b/addons/web/static/src/js/views/calendar/calendar_renderer.js index a4930c87d37..b61236131c6 100644 --- a/addons/web/static/src/js/views/calendar/calendar_renderer.js +++ b/addons/web/static/src/js/views/calendar/calendar_renderer.js @@ -288,7 +288,7 @@ return AbstractRenderer.extend({ if (field.type === "one2many" || field.type === "many2many") { return field_utils.format[field.type]({data: record[fieldName]}, field); } else { - return field_utils.format[field.type](record[fieldName], field); + return field_utils.format[field.type](record[fieldName], field, {forceString: true}); } }, /** diff --git a/addons/web/static/tests/views/calendar_tests.js b/addons/web/static/tests/views/calendar_tests.js index 21e4e8c26a7..dfc42c6f746 100644 --- a/addons/web/static/tests/views/calendar_tests.js +++ b/addons/web/static/tests/views/calendar_tests.js @@ -433,6 +433,7 @@ QUnit.module('Views', { 'readonly_form_view_id="1">'+ ''+ ''+ + ''+ '', archs: archs, viewOptions: { @@ -480,8 +481,8 @@ QUnit.module('Views', { $('.modal button.btn:contains(Create)').trigger('click'); var $newevent = calendar.$('.fc-event:contains(new event)'); - assert.strictEqual($newevent.text().replace(/[\s\n\r]+/g, ''), "08:00-10:00newevent12/13/201608:00:00", - "should display the new event with time and title"); + assert.strictEqual($newevent.text().replace(/[\s\n\r]+/g, ''), "08:00-10:00newevent12/13/201608:00:00False", + "should display the new event with time, title and additional fields"); assert.deepEqual($newevent.data('fcSeg').event.record, {