From 48b4e42bd802043246c8fb09664b8fbdfd653e4b Mon Sep 17 00:00:00 2001 From: Maxime Gasselin Date: Mon, 25 Feb 2019 16:22:41 +0100 Subject: [PATCH] [creditmutuel] skip withdraw in deferred card history These transactions are also present on the associated checking account. Moreover, these tranactions do not have to be in present in the deferred card history. Closes: 9816@zendesk --- modules/creditmutuel/pages.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/creditmutuel/pages.py b/modules/creditmutuel/pages.py index 07f30e0b51..4213db9f4e 100644 --- a/modules/creditmutuel/pages.py +++ b/modules/creditmutuel/pages.py @@ -901,7 +901,9 @@ def condition(self): return not CleanText('//td[contains(., "Aucun mouvement")]', default=False)(self) or not CleanText('//td[contains(., "Aucune opération")]', default=False)(self) class item(Transaction.TransactionElement): - condition = lambda self: len(self.el.xpath('./td')) >= 4 + def condition(self): + # Withdraw transactions are also presents on the checking account + return len(self.el.xpath('./td')) >= 4 and not CleanText(TableCell('commerce'))(self).startswith('RETRAIT CB') obj_raw = Transaction.Raw(Format("%s %s", CleanText(TableCell('commerce')), CleanText(TableCell('ville')))) obj_rdate = Field('vdate') @@ -949,7 +951,7 @@ def condition(self): class item(Transaction.TransactionElement): def condition(self): - return len(self.el.xpath('./td')) >= 4 + return len(self.el.xpath('./td')) >= 4 and not CleanText(TableCell('operation'))(self).startswith('RETRAIT CB') obj_label = CleanText(TableCell('operation')) @@ -979,6 +981,10 @@ class list_history(Transaction.TransactionsElement): col_ville = 'Ville' class item(Transaction.TransactionElement): + def condition(self): + # Withdraw transactions are also presents on the checking account + return not CleanText(TableCell('commerce'))(self).startswith('RETRAIT CB') + obj_raw = Transaction.Raw(Format("%s %s", CleanText(TableCell('commerce')), CleanText(TableCell('ville')))) obj_rdate = Field('vdate') obj_date = Env('date') -- GitLab