set type of accounts on professional accounts
This commit is contained in:
parent
ec1a245540
commit
39e00ab2a1
1 changed files with 22 additions and 13 deletions
|
|
@ -35,8 +35,16 @@ class HistoryParser(CsvParser):
|
||||||
|
|
||||||
|
|
||||||
class ProAccountsList(Page):
|
class ProAccountsList(Page):
|
||||||
|
ACCOUNT_TYPES = {u'Comptes épargne': Account.TYPE_SAVINGS,
|
||||||
|
u'Comptes courants': Account.TYPE_CHECKING,
|
||||||
|
}
|
||||||
def get_accounts_list(self):
|
def get_accounts_list(self):
|
||||||
for tr in self.document.xpath('//div[@class="comptestabl"]/table/tbody/tr'):
|
for table in self.document.xpath('//div[@class="comptestabl"]/table'):
|
||||||
|
try:
|
||||||
|
account_type = self.ACCOUNT_TYPES[table.xpath('./caption/text()')[0].strip()]
|
||||||
|
except (IndexError,KeyError):
|
||||||
|
account_type = Account.TYPE_UNKNOWN
|
||||||
|
for tr in table.xpath('./tbody/tr'):
|
||||||
cols = tr.findall('td')
|
cols = tr.findall('td')
|
||||||
|
|
||||||
link = cols[0].find('a')
|
link = cols[0].find('a')
|
||||||
|
|
@ -44,6 +52,7 @@ class ProAccountsList(Page):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
a = Account()
|
a = Account()
|
||||||
|
a.type = account_type
|
||||||
a.id, a.label = map(unicode, link.attrib['title'].split(' ', 1))
|
a.id, a.label = map(unicode, link.attrib['title'].split(' ', 1))
|
||||||
tmp_balance = self.parser.tocleanstring(cols[1])
|
tmp_balance = self.parser.tocleanstring(cols[1])
|
||||||
a.currency = a.get_currency(tmp_balance)
|
a.currency = a.get_currency(tmp_balance)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue