Commit 4096d430 authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Romain Bignon

[groupama] Corrected investment total valuation and codes

Some investments that have 'Détail' in the label are actually a sum-up
of other invests, we must ignore them to avoid valuation duplicates.
I also corrected the codes and code_types for these invests.

Closes: 9840@zendesk
parent ecdd83d1
......@@ -27,12 +27,13 @@ from decimal import Decimal
from weboob.browser.pages import HTMLPage, pagination, LoggedPage, FormNotFound, JsonPage
from weboob.browser.elements import method, TableElement, ItemElement
from weboob.browser.filters.standard import Env, CleanDecimal, CleanText, Date, Regexp, Eval
from weboob.browser.filters.standard import Env, CleanDecimal, CleanText, Date, Regexp, Eval, Field
from weboob.browser.filters.html import Attr, Link, TableCell
from weboob.browser.filters.javascript import JSVar
from import Account, Investment
from weboob.capabilities.base import NotAvailable
from import FrenchTransaction
from import is_isin_valid
from weboob.browser.filters.json import Dict
......@@ -206,16 +207,20 @@ class AVAccountPage(LoggedPage, HTMLPage):
klass = Investment
def condition(self):
return CleanText('./th')(self) != 'Total épargne constituée'
return (CleanText('./th')(self) != 'Total épargne constituée') and ('Détail' not in Field('label')(self))
obj_label = CleanText('./th')
obj_quantity = CleanDecimal(TableCell('quantity'), default=NotAvailable)
obj_unitvalue = CleanDecimal(TableCell('unitvalue'), default=NotAvailable)
obj_valuation = CleanDecimal(TableCell('valuation'), default=NotAvailable)
obj_portfolio_share = Eval(lambda x: x / 100, CleanDecimal(TableCell('portfolio_share')))
obj_code = Regexp(Link('./th/a'), r'isin=(\w+)|/(\w+)\.pdf')
obj_code = Regexp(Link('./th/a', default=''), r'isin=(\w+)|/(\w+)\.pdf', default=NotAvailable)
obj_code_type = Investment.CODE_TYPE_ISIN
def obj_code(self):
code = Regexp(Link('./th/a', default=''), r'isin=(\w+)|/(\w+)\.pdf', default=NotAvailable)(self)
return code if is_isin_valid(code) else NotAvailable
def obj_code_type(self):
return Investment.CODE_TYPE_ISIN if is_isin_valid(Field('code')(self)) else NotAvailable
class AvJPage(LoggedPage, JsonPage):
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