diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 819301f9e55..7f220d0aa54 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -102,10 +102,6 @@ openerp.web.format_value = function (value, descriptor, value_if_empty) { return _.str.sprintf("%02d:%02d", Math.floor(value), Math.round((value % 1) * 60)); - case 'progressbar': - return _.str.sprintf( - '%.2f%%', - value, value); case 'many2one': // name_get value format return value[1]; @@ -284,7 +280,7 @@ openerp.web.format_cell = function (row_data, column, options) { return options.value_if_empty === undefined ? '' : options.value_if_empty; } - switch (column.type) { + switch (column.widget || column.type) { case "boolean": return _.str.sprintf('', row_data[column.id].value ? 'checked="checked"' : ''); @@ -298,15 +294,20 @@ openerp.web.format_cell = function (row_data, column, options) { row_data[column.filename].value, {type: 'char'})); } } - return _.str.sprintf('%(text)s (%(size)s)', { + return _.template('<%-text%> (%<-size%>)', { text: text, href: download_url, size: row_data[column.id].value }); + case 'progressbar': + return _.template( + '<%-value%>%', { + value: row_data[column.id].value + }); } - return openerp.web.format_value( - row_data[column.id].value, column, options.value_if_empty); + return _.escape(openerp.web.format_value( + row_data[column.id].value, column, options.value_if_empty)); } };