support empty dates for transactions
This commit is contained in:
parent
3870559155
commit
63dc4e05da
2 changed files with 11 additions and 3 deletions
|
|
@ -91,7 +91,7 @@ class TransactionsFormatter(IFormatter):
|
||||||
label = obj.label
|
label = obj.label
|
||||||
if not label and hasattr(obj, 'raw'):
|
if not label and hasattr(obj, 'raw'):
|
||||||
label = obj.raw
|
label = obj.raw
|
||||||
return ' %-10s %-12s %-50s %10.2f' % (obj.date.strftime('%Y-%m-%d'), _type[:12], label[:50], obj.amount)
|
return ' %-10s %-12s %-50s %10.2f' % (obj.date.strftime('%Y-%m-%d') if not empty(obj.date) else '', _type[:12], label[:50], obj.amount)
|
||||||
|
|
||||||
|
|
||||||
class TransferFormatter(IFormatter):
|
class TransferFormatter(IFormatter):
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import re
|
||||||
from weboob.capabilities.bank import Transaction
|
from weboob.capabilities.bank import Transaction
|
||||||
from weboob.capabilities import NotAvailable
|
from weboob.capabilities import NotAvailable
|
||||||
from weboob.tools.misc import to_unicode
|
from weboob.tools.misc import to_unicode
|
||||||
|
from weboob.tools.log import getLogger
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['FrenchTransaction']
|
__all__ = ['FrenchTransaction']
|
||||||
|
|
@ -36,6 +37,10 @@ class FrenchTransaction(Transaction):
|
||||||
"""
|
"""
|
||||||
PATTERNS = []
|
PATTERNS = []
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
Transaction.__init__(self, *args, **kwargs)
|
||||||
|
self.logger = getLogger('FrenchTransaction')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def clean_amount(klass, text):
|
def clean_amount(klass, text):
|
||||||
"""
|
"""
|
||||||
|
|
@ -87,7 +92,10 @@ class FrenchTransaction(Transaction):
|
||||||
date = datetime.date(int(date[4:8]), int(date[2:4]), int(date[0:2]))
|
date = datetime.date(int(date[4:8]), int(date[2:4]), int(date[0:2]))
|
||||||
elif '/' in date:
|
elif '/' in date:
|
||||||
date = datetime.date(*reversed([int(x) for x in date.split('/')]))
|
date = datetime.date(*reversed([int(x) for x in date.split('/')]))
|
||||||
if date.year < 100:
|
if not isinstance(date, (datetime.date, datetime.datetime)):
|
||||||
|
self.logger.warning('Unable to parse date %r' % date)
|
||||||
|
date = NotAvailable
|
||||||
|
elif date.year < 100:
|
||||||
date = date.replace(year=2000 + date.year)
|
date = date.replace(year=2000 + date.year)
|
||||||
|
|
||||||
self.date = date
|
self.date = date
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue