Add a new field to Operations to permit a better export to qif

Signed-off-by: Romain Bignon <romain@peerfuse.org>
This commit is contained in:
ffourcot 2011-09-08 17:24:45 +02:00 committed by Romain Bignon
commit 9d900578a3
2 changed files with 3 additions and 1 deletions

View file

@ -29,7 +29,7 @@ __all__ = ['Boobank']
class QifFormatter(IFormatter): class QifFormatter(IFormatter):
MANDATORY_FIELDS = ('id', 'date', 'label', 'amount') MANDATORY_FIELDS = ('id', 'date', 'label', 'amount', 'category')
count = 0 count = 0
@ -43,6 +43,7 @@ class QifFormatter(IFormatter):
result += u'D%s\n' % item['date'].strftime('%d/%m/%y') result += u'D%s\n' % item['date'].strftime('%d/%m/%y')
result += u'T%s\n' % item['amount'] result += u'T%s\n' % item['amount']
result += u'M%s\n' % item['label'] result += u'M%s\n' % item['label']
result += u'N%s\n' % item['category']
result += u'^\n' result += u'^\n'
self.count += 1 self.count += 1
return result return result

View file

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