Commit 82ad328f authored by Florent Viard's avatar Florent Viard Committed by Vincent A

[bred] Avoid crash when find_object is used on accounts matching by _number

Add a private _number field to non payment Accounts (loan,
lifeinsurance) to be consistent with the Account objects of payment
accounts.

This avoid a crash when we try to use find_object to match a life
insurance with its parent by comparing the _number value with all the
accounts.
parent f962c079
......@@ -32,7 +32,7 @@
from woob.capabilities.wealth import Investment
from woob.tools.capabilities.bank.investments import is_isin_valid
from woob.capabilities.profile import Person
from woob.browser.filters.standard import CleanText, CleanDecimal, Env, Eval
from woob.browser.filters.standard import CleanText, CleanDecimal, Env, Eval, Field
from woob.browser.filters.html import Link
from woob.browser.filters.json import Dict
from woob.browser.elements import DictElement, ItemElement, method
......@@ -140,6 +140,7 @@ def iter_loans(self, current_univers):
a.balance = -Decimal(str(content['montantCapitalDu']['valeur']))
a.currency = content['montantCapitalDu']['monnaie']['code'].strip()
a._univers = current_univers
a._number = Field('id')
yield a
......@@ -268,6 +269,7 @@ class item(ItemElement):
obj_type = Account.TYPE_LIFE_INSURANCE
obj_currency = 'EUR'
obj__univers = Env('univers')
obj__number = Field('id')
def obj_id(self):
return Eval(str, Dict('numero'))(self)
......
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