From caa90d41dc4f741be7e2ce214b9afb26181d2aac Mon Sep 17 00:00:00 2001 From: Christophe Francois Date: Fri, 6 Nov 2020 14:11:45 +0100 Subject: [PATCH] [creditmutuel] Fix duplicate portfolio accounts I misunderstood the issue with duplicate IDs in the portfolio accounts page. The issue is that liquidities accounts which were fetched on the main accounts page are now also on the portfolio page. Because of this change we fetched them twice. This commit reverts the change on account IDs on the portfolio page and ignores the liquidities accounts on this page. --- modules/creditmutuel/pages.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/creditmutuel/pages.py b/modules/creditmutuel/pages.py index cd03c53816..7cc2b6cd76 100644 --- a/modules/creditmutuel/pages.py +++ b/modules/creditmutuel/pages.py @@ -1608,10 +1608,15 @@ def condition(self): self.env['id'] = CleanText('.//a', replace=[(' ', '')])(self) self.env['balance'] = CleanDecimal.French(TableCell('balance'), default=None)(self) is_total = 'TOTAL VALO' in CleanText('.')(self) + is_liquidity = ( + 'LIQUIDITE' in CleanText(TableCell('raw_label'))(self) + or 'TOTAL Compte espèces' in CleanText('.')(self) + ) is_global_view = Env('id')(self) == 'Vueconsolidée' has_empty_balance = Env('balance')(self) is None return ( not is_total + and not is_liquidity and not is_global_view and not has_empty_balance ) @@ -1632,11 +1637,8 @@ def condition(self): obj__link_id = Regexp(Link('.//a', default=''), r'ddp=([^&]*)', default=NotAvailable) # IDs on the old page were differentiated with 5 digits in front of the ID, but not here. - # We still need to differentiate them so we add ".1" at the end of the liquidities account. - def obj_id(self): - if 'LIQUIDITE' in CleanText(TableCell('raw_label'))(self): - return Format('%s.1', Env('id'))(self) - return Env('id')(self) + # We still need to differentiate them so we add ".1" at the end. + obj_id = Format('%s.1', Env('id')) def obj_type(self): return self.page.get_type(Field('label')(self)) -- GitLab