display the 'N' entry only when available

This commit is contained in:
Romain Bignon 2011-09-09 09:54:07 +02:00
commit 51f8efc41d
2 changed files with 3 additions and 2 deletions

View file

@ -42,8 +42,9 @@ class QifFormatter(IFormatter):
result += u'!type:Bank\n'
result += u'D%s\n' % item['date'].strftime('%d/%m/%y')
result += u'T%s\n' % item['amount']
if item['category']:
result += u'N%s\n' % item['category']
result += u'M%s\n' % item['label']
result += u'N%s\n' % item['category']
result += u'^\n'
self.count += 1
return result

View file

@ -57,9 +57,9 @@ class Operation(CapBaseObject):
def __init__(self, id):
CapBaseObject.__init__(self, id)
self.add_field('date', (basestring, datetime, date))
self.add_field('category', unicode)
self.add_field('label', unicode)
self.add_field('amount', float)
self.add_field('category', unicode)
def __repr__(self):
return "<Operation date='%s' label='%s' amount=%s>" % (self.date,