Format integer for quantity
This commit is contained in:
parent
8672a6b443
commit
c2d7b662aa
1 changed files with 5 additions and 1 deletions
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue