From be663cbb527117e06914fc1395c0cbb32ce44805 Mon Sep 17 00:00:00 2001 From: Guillaume Risbourg Date: Thu, 19 Dec 2019 12:07:42 +0100 Subject: [PATCH] [caissedepargne] Fixed get_measure_accounts_list + add ownership for old website --- modules/caissedepargne/browser.py | 4 +++- modules/caissedepargne/pages.py | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/caissedepargne/browser.py b/modules/caissedepargne/browser.py index 3aec68fc34..6bff755aac 100644 --- a/modules/caissedepargne/browser.py +++ b/modules/caissedepargne/browser.py @@ -395,6 +395,8 @@ def loans_conso(self): def get_measure_accounts_list(self): self.home.go() + owner_name = self.get_profile().name.upper().split(' ', 1)[1] + # Make sure we are on list of measures page if self.measure_page.is_here(): self.page.check_no_accounts() @@ -403,7 +405,7 @@ def get_measure_accounts_list(self): for measure_id in measure_ids: self.page.go_measure_accounts_list(measure_id) if self.page.check_measure_accounts(): - for account in list(self.page.get_list()): + for account in list(self.page.get_list(owner_name)): account._info['measure_id'] = measure_id self.accounts.append(account) self.page.go_measure_list() diff --git a/modules/caissedepargne/pages.py b/modules/caissedepargne/pages.py index 17c2937b39..176cd4c7d0 100644 --- a/modules/caissedepargne/pages.py +++ b/modules/caissedepargne/pages.py @@ -384,6 +384,7 @@ def get_list(self, owner_name): else: # On the same row, there could have many accounts (check account and a card one). # For the card line, the number will be the same than the checking account, so we skip it. + ownership = self.get_ownership(tds, owner_name) if len(tds) > 4: for i, a in enumerate(tds[2].xpath('./a')): label = CleanText('.')(a) @@ -393,13 +394,13 @@ def get_list(self, owner_name): # checking parent account, we have to skip it. if i == 0: number = CleanText('.')(tds[-4].xpath('./a')[0]) - self._add_account(accounts, a, label, account_type, balance, number) + self._add_account(accounts, a, label, account_type, balance, number, ownership=ownership) # Only 4 tds on "banque de la reunion" website. elif len(tds) == 4: for i, a in enumerate(tds[1].xpath('./a')): label = CleanText('.')(a) balance = CleanText('.')(tds[-1].xpath('./a')[i]) - self._add_account(accounts, a, label, account_type, balance) + self._add_account(accounts, a, label, account_type, balance, ownership=ownership) self.logger.warning('we are on the %s website', 'old' if accounts else 'new') -- GitLab