diff --git a/modules/bnporc/pp/pages.py b/modules/bnporc/pp/pages.py index 44bc89ed8f7e676d4dc89135f0f58ca745a101eb..ed7774b0b7ed28ef8c55940acfb9927f4a8f83fa 100644 --- a/modules/bnporc/pp/pages.py +++ b/modules/bnporc/pp/pages.py @@ -961,7 +961,12 @@ class MarketPage(BNPPage): def iter_investments(self): for support in self.path(self.investments_path): inv = Investment() - inv.code = inv.id = support['securityCode'] + inv.id = support['securityCode'] + if is_isin_valid(support['securityCode']): + inv.code = support['securityCode'] + inv.code_type = Investment.CODE_TYPE_ISIN + else: + inv.code = inv.code_type = NotAvailable inv.quantity = support['quantityOwned'] inv.unitvalue = support['currentQuote'] inv.unitprice = support['averagePrice'] @@ -985,7 +990,11 @@ def iter_history(self): tr.investments = [] inv = Investment() - inv.code = op.get('securityCode') + if is_isin_valid(op.get('securityCode')): + inv.code = op.get('securityCode') + inv.code_type = Investment.CODE_TYPE_ISIN + else: + inv.code = inv.code_type = NotAvailable inv.quantity = op.get('movementQuantity') inv.label = op.get('securityName') inv.set_empty_fields(NotAvailable)