From f3fe53189490e46e57998d3ee85f7a6c8c23ffbd Mon Sep 17 00:00:00 2001 From: Maxime Pommier Date: Thu, 23 May 2019 12:03:03 +0200 Subject: [PATCH] [caissedepargne] Fix iter account/coming/history for card account when there is no coming Closes: 41707@sibi --- modules/caissedepargne/browser.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/modules/caissedepargne/browser.py b/modules/caissedepargne/browser.py index aaf7b33ca6..60afd65065 100644 --- a/modules/caissedepargne/browser.py +++ b/modules/caissedepargne/browser.py @@ -450,9 +450,13 @@ def get_accounts_list(self): if self.cards.is_here(): for card in cards: info = card.parent._card_links - self.page.go_list() - self.page.go_history(info) - card._coming_info = self.page.get_card_coming_info(card.number, info.copy()) + + # If info is filled, that mean there are comings transaction + card._coming_info = None + if info: + self.page.go_list() + self.page.go_history(info) + card._coming_info = self.page.get_card_coming_info(card.number, info.copy()) self.accounts.extend(cards) @@ -528,7 +532,7 @@ def _get_history(self, info, account_card=None): # In this case, we want the coming transaction for the new website # (old website return coming directly in `get_coming()` ) - if account_card and info['type'] == 'HISTORIQUE_CB': + if account_card and info and info['type'] == 'HISTORIQUE_CB': self.page.go_coming(account_card._coming_info['link']) info['link'] = [info['link']] @@ -688,9 +692,11 @@ def get_coming(self, account): # We are on the new website. info = account.parent._card_links - for tr in self._get_history(info.copy(), account): - tr.type = tr.TYPE_DEFERRED_CARD - trs.append(tr) + # if info is empty, that mean there are no coming yet + if info: + for tr in self._get_history(info.copy(), account): + tr.type = tr.TYPE_DEFERRED_CARD + trs.append(tr) return sorted_transactions(trs) -- GitLab