fix inconsistent history on loan accounts if there is no init date

This commit is contained in:
Romain Bignon 2014-11-27 14:22:23 +01:00
commit cb511a7245

View file

@ -23,6 +23,7 @@ from decimal import Decimal, InvalidOperation
import re import re
from cStringIO import StringIO from cStringIO import StringIO
from weboob.capabilities import NotAvailable
from weboob.capabilities.bank import Account from weboob.capabilities.bank import Account
from weboob.browser.pages import HTMLPage, LoggedPage from weboob.browser.pages import HTMLPage, LoggedPage
from weboob.browser.elements import ListElement, ItemElement, method from weboob.browser.elements import ListElement, ItemElement, method
@ -137,6 +138,9 @@ class IndexPage(LoggedPage, HTMLPage):
total_amount = - self.loan_total_amount(self.doc) total_amount = - self.loan_total_amount(self.doc)
amount = self.loan_amount(self.doc) amount = self.loan_amount(self.doc)
if init_date is NotAvailable and total_amount == Decimal('0.0'):
return
for _ in xrange(nb): for _ in xrange(nb):
next_date = next_date - relativedelta(months=1) next_date = next_date - relativedelta(months=1)
tr = Transaction() tr = Transaction()