From b81cd98271a59dda7142ca898b73ac387db5951a Mon Sep 17 00:00:00 2001 From: Damien Mat Date: Tue, 25 Jun 2019 16:35:38 +0200 Subject: [PATCH] [creditmutuel] Added SRD-type actions in invest In case of SRD actions, regular and SRD quantities are displayed in the same cell, we must then add the values in text such as '4 444 + 10000 SRD' Closes: 11813@zendesk --- modules/creditmutuel/pages.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/creditmutuel/pages.py b/modules/creditmutuel/pages.py index f69105a412..d84166491c 100644 --- a/modules/creditmutuel/pages.py +++ b/modules/creditmutuel/pages.py @@ -1259,7 +1259,20 @@ def condition(self): return not any(not x.isdigit() for x in Attr('.', 'id')(self)) obj_label = CleanText(TableCell('label'), default=NotAvailable) - obj_quantity = CleanDecimal(TableCell('quantity'), default=Decimal(0), replace_dots=True) + + def obj_quantity(self): + """ + In case of SRD actions, regular actions and SRD quantities are displayed in the same cell, + we must then add the values in text such as '4 444 + 10000 SRD' + """ + + quantity = CleanText(TableCell('quantity'))(self) + if '+' in quantity: + quantity_list = quantity.split('+') + return CleanDecimal.French().filter(quantity_list[0]) + CleanDecimal.French().filter(quantity_list[1]) + else: + return CleanDecimal.French().filter(quantity) + obj_unitprice = CleanDecimal(TableCell('unitprice'), default=Decimal(0), replace_dots=True) obj_valuation = CleanDecimal(TableCell('valuation'), default=Decimal(0), replace_dots=True) obj_diff = CleanDecimal(TableCell('diff'), default=Decimal(0), replace_dots=True) -- GitLab