From c2d7b662aad56d72adea9c1879f9458c9083f3d0 Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 23 Oct 2014 15:16:51 +0200 Subject: [PATCH] Format integer for quantity --- weboob/applications/boobank/boobank.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/weboob/applications/boobank/boobank.py b/weboob/applications/boobank/boobank.py index db9038a0..c27ae232 100644 --- a/weboob/applications/boobank/boobank.py +++ b/weboob/applications/boobank/boobank.py @@ -210,10 +210,14 @@ class InvestmentFormatter(IFormatter): self.tot_diff += diff self.tot_valuation += obj.valuation + format_quantity = '%11.2f' + if obj.quantity._isinteger(): + format_quantity = '%11d' + return u' %s %s %s %s %s %s' % \ (self.colored('%-30s' % label[:30], 'red'), self.colored('%-12s' % obj.code[:12], 'yellow') if not empty(obj.code) else ' ' * 12, - self.colored('%11.2f' % obj.quantity, 'yellow'), + self.colored(format_quantity % obj.quantity, 'yellow'), self.colored('%11.2f' % obj.unitvalue, 'yellow'), self.colored('%11.2f' % obj.valuation, 'yellow'), self.colored('%8.2f' % diff, 'green' if diff >= 0 else 'red')