diff --git a/modules/creditmutuel/pages.py b/modules/creditmutuel/pages.py index 4036844d73cc5200a9bb9770cd8f5ace3e7e8530..5c022608b55ae7162ff78b93b029df70efeb558b 100644 --- a/modules/creditmutuel/pages.py +++ b/modules/creditmutuel/pages.py @@ -1210,14 +1210,25 @@ def add_por_accounts(self, accounts): acc.type = self.get_type(acc.label) acc._is_inv = True self.fill(acc) - accounts.append(acc) + # Some market account haven't any valorisation, neither history. We skip them. + if not empty(acc.balance): + accounts.append(acc) def fill(self, acc): self.send_form(acc) ele = self.browser.page.doc.xpath('.//table[has-class("fiche bourse")]')[0] - balance = CleanDecimal(ele.xpath('.//td[contains(@id, "Valorisation")]'), - default=Decimal(0), replace_dots=True)(ele) - acc.balance = balance + acc.balance if acc.balance else balance + + balance = CleanText('.//td[contains(@id, "Valorisation")]')(ele) + + # Valorisation will be filled with "NS" string if there isn't information + if balance == 'NS' and not acc.balance: + acc.balance = NotAvailable + else: + balance = CleanDecimal.French(default=0).filter(balance) + if acc.balance: + acc.balance += balance + else: + acc.balance = balance acc.valuation_diff = CleanDecimal(ele.xpath('.//td[contains(@id, "Variation")]'), default=Decimal(0), replace_dots=True)(ele) if balance: