From 6dcd2497f9bb6627e70cb88305f3a19e46c46511 Mon Sep 17 00:00:00 2001 From: Yusei Tahara <yusei@nexedi.com> Date: Mon, 18 Oct 2010 03:22:55 +0000 Subject: [PATCH] Fix a bug. If precision was 1, rounding did not work correctly. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39268 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/RoundingModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/ERP5/Document/RoundingModel.py b/product/ERP5/Document/RoundingModel.py index be71346f90..a7153cad36 100644 --- a/product/ERP5/Document/RoundingModel.py +++ b/product/ERP5/Document/RoundingModel.py @@ -76,7 +76,7 @@ class RoundingModel(Predicate): precision = 1 scale = int(log(precision, 10)) - if scale > 0: + if scale > 0 or (scale==0 and precision>=1): value = Decimal(str(value)) scale = Decimal(str(int(precision))).quantize(value) precision = Decimal('1') -- 2.30.9