From f8888467400dadfac6d680d4a5867a83b9347852 Mon Sep 17 00:00:00 2001 From: Quentin Defenouillere Date: Thu, 31 Jan 2019 16:42:38 +0100 Subject: [PATCH] [caissedepargne] Corrected type and balance xpath for LI and Capitalisation --- modules/caissedepargne/pages.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/caissedepargne/pages.py b/modules/caissedepargne/pages.py index 0cfe9407a6..a9032b1885 100644 --- a/modules/caissedepargne/pages.py +++ b/modules/caissedepargne/pages.py @@ -296,6 +296,8 @@ def _add_account(self, accounts, link, label, account_type, balance): account.type = self.ACCOUNT_TYPES.get(label, info['acc_type'] if 'acc_type' in info else account_type) if 'PERP' in account.label: account.type = Account.TYPE_PERP + if 'NUANCES CAPITALISATI' in account.label: + account.type = Account.TYPE_CAPITALISATION balance = balance or self.get_balance(account) account.balance = Decimal(FrenchTransaction.clean_amount(balance)) if balance and balance is not NotAvailable else NotAvailable @@ -315,10 +317,10 @@ def _add_account(self, accounts, link, label, account_type, balance): accounts[account.id] = account def get_balance(self, account): - if account.type not in (Account.TYPE_LIFE_INSURANCE, Account.TYPE_PERP): + if account.type not in (Account.TYPE_LIFE_INSURANCE, Account.TYPE_PERP, Account.TYPE_CAPITALISATION): return NotAvailable page = self.go_history(account._info).page - balance = page.doc.xpath('.//tr[td[ends-with(@id,"NumContrat")]/a[contains(text(),$id)]]/td[@class="somme"]', id=account.id) + balance = page.doc.xpath('.//tr[td[contains(@id,"NumContrat")]]/td[@class="somme"]/a[contains(@href, $id)]', id=account.id) if len(balance) > 0: balance = CleanText('.')(balance[0]) balance = balance if balance != u'' else NotAvailable -- GitLab