The new woob repository is here: This gitlab will be removed soon.

Commit d7857b7c authored by Baptiste Delpey's avatar Baptiste Delpey Committed by Romain Bignon

[spirica] fix when life insurance are splited in different gestions

parent 26ca1f86
......@@ -79,7 +79,7 @@ def iter_history(self, account):
return self.cache['trs'][]
def fill_from_list(self, invs, objects_list):
matching_fields = ['code', 'unitvalue', 'label']
matching_fields = ['code', 'unitvalue', 'label', '_gestion_type']
for inv in invs:
obj_from_list = [o for o in objects_list if all(getattr(o, field) == getattr(inv, field) for field in matching_fields)]
assert len(obj_from_list) == 1
......@@ -95,6 +95,7 @@ class TableInvestment(TableElement):
col_unitvalue = u'Valeur de part'
col_quantity = u'Nombre de parts'
col_portfolio_share = u'%'
col__gestion_type = re.compile('Nom du profil')
class ItemInvestment(ItemElement):
......@@ -115,6 +116,18 @@ def obj_portfolio_share(self):
ps = MyDecimal(TableCell('portfolio_share', default=None))(self)
return Eval(lambda x: x / 100, ps)(self) if not empty(ps) else NotAvailable
def obj__gestion_type(self):
if self.xpath('ancestor::tbody[ends-with(@id, "contratProfilTable_data")]'):
# investments are nested in profiles, get profile type
profile_table_el = self.xpath('ancestor::tr/ancestor::table[position() = 1]')[0]
profile_table = ProfileTableInvestment(, self, profile_table_el)
gestion_type = profile_table.get_colnum('_gestion_type')
assert gestion_type
path = 'ancestor::tr/preceding-sibling::tr[@data-ri][position() = 1][1]/td[%d]' % (gestion_type + 1)
return CleanText(path)(self)
return NotAvailable
class TableTransactionsInvestment(TableInvestment):
item_xpath = './tbody/tr'
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