[FIX] don't display negative numbers for the decimal part of floats, having -3.-72 makes no sense

bzr revid: xmo@openerp.com-20110830150025-biqwrkt69wjye7n2
This commit is contained in:
Xavier Morel 2011-08-30 17:00:25 +02:00
parent 1300ac804d
commit 25eca5ffeb
1 changed files with 1 additions and 1 deletions

View File

@ -28,7 +28,7 @@ openerp.base.format_value = function (value, descriptor, value_if_empty) {
case 'float':
var precision = descriptor.digits ? descriptor.digits[1] : 2;
var int_part = Math.floor(value);
var dec_part = Math.floor((value % 1) * Math.pow(10, precision));
var dec_part = Math.abs(Math.floor((value % 1) * Math.pow(10, precision)));
return _.sprintf('%d' + openerp.base._t.database.parameters.decimal_point + '%d', int_part, dec_part);
case 'float_time':
return _.sprintf("%02d:%02d",