diff --git a/modules/caissedepargne/browser.py b/modules/caissedepargne/browser.py index 7adad3ec874192d575be4b38b82e5ff1dd262e63..e296359c719c189899084d0dc2145829038903a9 100644 --- a/modules/caissedepargne/browser.py +++ b/modules/caissedepargne/browser.py @@ -536,6 +536,9 @@ def _get_history_invests(self, account): self.page.go_history(account._info) if account.type in (Account.TYPE_LIFE_INSURANCE, Account.TYPE_PERP): + if self.page.is_account_inactive(account.id): + self.logger.warning('Account %s %s is inactive.' % (account.label, account.id)) + return iter([]) if "MILLEVIE" in account.label: self.page.go_life_insurance(account) label = account.label.split()[-1] @@ -627,6 +630,9 @@ def get_investment(self, account): return elif account.type in (Account.TYPE_LIFE_INSURANCE, Account.TYPE_CAPITALISATION): + if self.page.is_account_inactive(account.id): + self.logger.warning('Account %s %s is inactive.' % (account.label, account.id)) + return if "MILLEVIE" in account.label: self.page.go_life_insurance(account) label = account.label.split()[-1] diff --git a/modules/caissedepargne/pages.py b/modules/caissedepargne/pages.py index f55085ca53db599dcaacd000e3e01635be6340ca..e8443d2cec217d2838b1d468994b5f5967569c0d 100644 --- a/modules/caissedepargne/pages.py +++ b/modules/caissedepargne/pages.py @@ -281,6 +281,9 @@ def _get_account_info(self, a, accounts): info['acc_type'] = Account.TYPE_MARKET return info + def is_account_inactive(self, account_id): + return self.doc.xpath('//tr[td[contains(text(), $id)]][@class="Inactive"]', id=account_id) + def _add_account(self, accounts, link, label, account_type, balance): info = self._get_account_info(link, accounts) if info is None: