From 75eff5e44bc13d123786a40c93570f38290f0b02 Mon Sep 17 00:00:00 2001 From: Quentin Defenouillere Date: Wed, 3 Jun 2020 17:52:49 +0200 Subject: [PATCH] [bnporc] Added Investment.code_type --- modules/bnporc/pp/pages.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/bnporc/pp/pages.py b/modules/bnporc/pp/pages.py index 44bc89ed8f..ed7774b0b7 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) -- GitLab