From 6861cd24888621ecbc78c5ecaee7f0edea62d5c1 Mon Sep 17 00:00:00 2001 From: Quentin Defenouillere Date: Thu, 21 Feb 2019 11:05:45 +0100 Subject: [PATCH] [creditdunord] Corrected bugs for account.balance and LI investments --- modules/creditdunord/browser.py | 3 ++- modules/creditdunord/pages.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/creditdunord/browser.py b/modules/creditdunord/browser.py index e44a9740cc..218e8fa930 100644 --- a/modules/creditdunord/browser.py +++ b/modules/creditdunord/browser.py @@ -165,11 +165,12 @@ def get_investment(self, account): self.location(account._link, data=account._args) if self.page.can_iter_investments() and self.page.not_restrained(): return self.page.get_market_investment() + elif account.type in (Account.TYPE_LIFE_INSURANCE, Account.TYPE_CAPITALISATION): self.location(account._link, data=account._args) self.location(account._link.replace("_attente", "_detail_contrat_rep"), data=account._args) if self.page.can_iter_investments(): - return self.page.get_deposit_investment() + return self.page.get_li_investments() return [] @need_login diff --git a/modules/creditdunord/pages.py b/modules/creditdunord/pages.py index 65772d9202..c7c749df61 100755 --- a/modules/creditdunord/pages.py +++ b/modules/creditdunord/pages.py @@ -687,9 +687,9 @@ def condition(self): return "Sous-total" not in Field('label')(self) @method - class get_deposit_investment(TableElement): + class get_li_investments(TableElement): item_xpath = '//table[@class="datas"]//tr[position()>1]' - head_xpath = '//table[@class="datas"]//tr[@class="entete"]/td/b' + head_xpath = '//table[@class="datas"]//tr[@class="entete"]/td/*' col_label = u'Libellé' col_quantity = u'Quantité' @@ -726,7 +726,7 @@ def obj_vdate(self): def fill_diff_currency(self, account): valuation_diff = CleanText(u'//td[span[contains(text(), "dont +/- value : ")]]//b', default=None)(self.doc) - account.balance = CleanDecimal.French(Regexp(CleanText('//table[@class="v1-formbloc"]//td[@class="v1-labels"]/b[contains(text(), "Estimation du contrat")]/ancestor::td/following-sibling::td[1]'), r'^(.+) EUR'))(self.doc) + account.balance = CleanDecimal.French(Regexp(CleanText('//table[@class="v1-formbloc"]//td[@class="v1-labels"]//b[contains(text(), "Estimation du contrat")]/ancestor::td/following-sibling::td[1]'), r'^(.+) EUR'))(self.doc) # NC == Non communiqué if valuation_diff and "NC" not in valuation_diff: account.valuation_diff = MyDecimal().filter(valuation_diff) -- GitLab