Commit e2ed74f3 authored by Maxime Pommier's avatar Maxime Pommier Committed by Vincent A

[creditmutuel] Skip market account without information on their balance or...

[creditmutuel] Skip market account without information on their balance or history ("NC" unstead of the account balance number)
parent ba85595b
...@@ -1210,14 +1210,25 @@ class PorPage(LoggedPage, HTMLPage): ...@@ -1210,14 +1210,25 @@ class PorPage(LoggedPage, HTMLPage):
acc.type = self.get_type(acc.label) acc.type = self.get_type(acc.label)
acc._is_inv = True acc._is_inv = True
self.fill(acc) self.fill(acc)
accounts.append(acc) # Some market account haven't any valorisation, neither history. We skip them.
if not empty(acc.balance):
def fill(self, acc): def fill(self, acc):
self.send_form(acc) self.send_form(acc)
ele ='.//table[has-class("fiche bourse")]')[0] ele ='.//table[has-class("fiche bourse")]')[0]
balance = CleanDecimal(ele.xpath('.//td[contains(@id, "Valorisation")]'),
default=Decimal(0), replace_dots=True)(ele) balance = CleanText('.//td[contains(@id, "Valorisation")]')(ele)
acc.balance = balance + acc.balance if acc.balance else balance
# Valorisation will be filled with "NS" string if there isn't information
if balance == 'NS' and not acc.balance:
acc.balance = NotAvailable
balance = CleanDecimal.French(default=0).filter(balance)
if acc.balance:
acc.balance += balance
acc.balance = balance
acc.valuation_diff = CleanDecimal(ele.xpath('.//td[contains(@id, "Variation")]'), acc.valuation_diff = CleanDecimal(ele.xpath('.//td[contains(@id, "Variation")]'),
default=Decimal(0), replace_dots=True)(ele) default=Decimal(0), replace_dots=True)(ele)
if balance: if balance:
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