set the right debit date on card transactions

This commit is contained in:
Romain Bignon 2013-09-07 22:14:31 +02:00
commit ad4239d41c

View file

@ -214,8 +214,8 @@ class TransactionsPage(BasePage):
if col_label.find('a') is not None: if col_label.find('a') is not None:
col_label = col_label.find('a') col_label = col_label.find('a')
date = u''.join([txt.strip() for txt in cols[0].itertext()]) date = self.parser.tocleanstring(cols[0])
label = u''.join([txt.strip() for txt in col_label.itertext()]) label = self.parser.tocleanstring(col_label)
# always strip card debits transactions. if we are on a card page, all next # always strip card debits transactions. if we are on a card page, all next
# transactions will be probably already debited. # transactions will be probably already debited.
@ -240,8 +240,8 @@ class TransactionsPage(BasePage):
if t.label == t.raw: if t.label == t.raw:
t.label = label t.label = label
debit = u''.join([txt.strip() for txt in cols[-2].itertext()]) debit = self.parser.tocleanstring(cols[-2])
credit = u''.join([txt.strip() for txt in cols[-1].itertext()]) credit = self.parser.tocleanstring(cols[-1])
t.set_amount(credit, debit) t.set_amount(credit, debit)
if 'CUMUL DES DEPENSES CARTES BANCAIRES REGLEES' in t.raw: if 'CUMUL DES DEPENSES CARTES BANCAIRES REGLEES' in t.raw:
@ -251,6 +251,11 @@ class TransactionsPage(BasePage):
t._is_coming = bool(is_coming) t._is_coming = bool(is_coming)
# If this is a card, get the right debit date (rdate is already set
# with the operation date with t.parse())
if is_coming is not None:
t.date = t.parse_date(self.parser.tocleanstring(cols[-3]))
transactions.append(t) transactions.append(t)
if last_debit is not None and is_coming is True: if last_debit is not None and is_coming is True: