Commit 4de0b38a authored by Martin Sicot's avatar Martin Sicot Committed by Romain Bignon

[bp] french_liquidity added for invesments account

French liquidity wasn't retrieved.
parent 8ad9ed9c
...@@ -398,7 +398,9 @@ class BPBrowser(LoginBrowser, StatesMixin): ...@@ -398,7 +398,9 @@ class BPBrowser(LoginBrowser, StatesMixin):
if account.type in (account.TYPE_PEA, account.TYPE_MARKET): if account.type in (account.TYPE_PEA, account.TYPE_MARKET):
self.go_linebourse(account) self.go_linebourse(account)
return self.linebourse.iter_investment(account.id) investments = list(self.linebourse.iter_investment(account.id))
investments.append(self.linebourse.get_liquidity(account.id))
return investments
if account.type != Account.TYPE_LIFE_INSURANCE: if account.type != Account.TYPE_LIFE_INSURANCE:
return iter([]) return iter([])
......
...@@ -72,7 +72,24 @@ class LinebourseBrowser(LoginBrowser): ...@@ -72,7 +72,24 @@ class LinebourseBrowser(LoginBrowser):
assert self.invest.is_here() assert self.invest.is_here()
if not self.page.is_on_right_portfolio(account_id): if not self.page.is_on_right_portfolio(account_id):
self.invest.go(id=self.page.get_compte(account_id)) self.invest.go(id=self.page.get_compte(account_id))
return self.page.iter_investment() return self.page.iter_investments()
# Method used only by bp module
def get_liquidity(self, account_id):
self.main.go()
self.invest.go()
if self.message.is_here():
self.page.submit()
self.invest.go()
if self.broken.is_here():
return iter([])
assert self.invest.is_here()
if not self.page.is_on_right_portfolio(account_id):
self.invest.go(id=self.page.get_compte(account_id))
return self.page.get_liquidity()
def iter_history(self, account_id): def iter_history(self, account_id):
self.main.go() self.main.go()
......
...@@ -30,6 +30,7 @@ from weboob.browser.filters.html import TableCell ...@@ -30,6 +30,7 @@ from weboob.browser.filters.html import TableCell
from weboob.capabilities.base import NotAvailable from weboob.capabilities.base import NotAvailable
from weboob.capabilities.bank import Investment from weboob.capabilities.bank import Investment
from weboob.tools.capabilities.bank.transactions import FrenchTransaction as Transaction from weboob.tools.capabilities.bank.transactions import FrenchTransaction as Transaction
from weboob.tools.capabilities.bank.investments import create_french_liquidity
from weboob.tools.compat import quote_plus from weboob.tools.compat import quote_plus
from weboob.exceptions import ActionNeeded from weboob.exceptions import ActionNeeded
...@@ -110,7 +111,7 @@ class HistoryPage(AccountPage): ...@@ -110,7 +111,7 @@ class HistoryPage(AccountPage):
class InvestmentPage(AccountPage): class InvestmentPage(AccountPage):
@method @method
class get_investment(TableElement): class iter_investments(TableElement):
col_label = 'Valeur' col_label = 'Valeur'
col_quantity = u'Quantité' col_quantity = u'Quantité'
col_valuation = u'Valorisation EUR' col_valuation = u'Valorisation EUR'
...@@ -139,9 +140,11 @@ class InvestmentPage(AccountPage): ...@@ -139,9 +140,11 @@ class InvestmentPage(AccountPage):
obj_label = CleanText(Regexp(CleanText('./preceding-sibling::tr/td[1]'), '(.*)- .*')) obj_label = CleanText(Regexp(CleanText('./preceding-sibling::tr/td[1]'), '(.*)- .*'))
obj_code = Regexp(CleanText('./preceding-sibling::tr/td[1]'), '- (.*)') obj_code = Regexp(CleanText('./preceding-sibling::tr/td[1]'), '- (.*)')
def iter_investment(self): # Only used by bp modules since others quality websites provide another account with the liquidities
for inv in self.get_investment(): def get_liquidity(self):
yield inv liquidity = CleanDecimal('//table//tr[@class="titreAvant"]/td[contains(text(), "Liquidit")]/following-sibling::td', replace_dots=True)(self.doc)
if liquidity:
return create_french_liquidity(liquidity)
class MessagePage(LoggedPage, HTMLPage): class MessagePage(LoggedPage, HTMLPage):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment