From 1d1093038bae2ecedf37b99cafb218df6cbde642 Mon Sep 17 00:00:00 2001 From: Christophe Francois Date: Thu, 8 Apr 2021 10:49:39 +0200 Subject: [PATCH] [lcl] Fix unitvalue currency All values are in the account's currency except for unitvalue which can be in its original currency. --- modules/lcl/pages.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/lcl/pages.py b/modules/lcl/pages.py index 1bfda45f93..ba064211ea 100644 --- a/modules/lcl/pages.py +++ b/modules/lcl/pages.py @@ -1003,11 +1003,25 @@ def obj_code_type(self): return Investment.CODE_TYPE_ISIN return NotAvailable + def obj_original_currency(self): + # Only the unitvalue is in its original currency + currency = Currency('.//td[4]')(self) + if currency != Currency('.//td[5]')(self): + return currency + return NotAvailable + def obj_unitvalue(self): if "%" in CleanText('.//td[4]')(self) and "%" in CleanText('.//td[6]')(self): return NotAvailable + if Field('original_currency')(self): + return NotAvailable return MyDecimal('.//td[4]/text()')(self) + def obj_original_unitvalue(self): + if Field('original_currency')(self): + return MyDecimal('.//td[4]/text()')(self) + return NotAvailable + def obj_unitprice(self): if "%" in CleanText('.//td[4]')(self) and "%" in CleanText('.//td[6]')(self): return NotAvailable -- GitLab