Commit d002c93c authored by Martin Morlot's avatar Martin Morlot Committed by ntome

[bp] Ignore invalid loans

Certain loans are invalid as thus conditions were added for them to be valid.

Closes: 42885@sibi, 12073@zendesk, 42778@sibi, 12114@zendesk, 12088@zendesk, 12061@zendesk
parent a7b5177e
......@@ -51,7 +51,11 @@ class item_account_generic(ItemElement):
def condition(self):
# For some loans the following xpath is absent and we don't want to skip them
return len(self.el.xpath('.//span[@class="number"]')) > 0 or Field('type')(self) == Account.TYPE_LOAN
# Also a case of loan that is empty and has no information exists and will be ignored
return (len(self.el.xpath('.//span[@class="number"]')) > 0 or
(Field('type')(self) == Account.TYPE_LOAN and
(len(self.el.xpath('.//div//*[contains(text(),"pas la restitution de ces données.")]')) == 0 and
len(self.el.xpath('.//div[@class="amount"]/span[contains(text(), "Contrat résilié")]')) == 0)))
obj_id = CleanText('.//abbr/following-sibling::text()')
obj_currency = Currency('.//span[@class="number"]')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment