From 82ad328f22c14b3d6b44f9c2bcc057983ebaa882 Mon Sep 17 00:00:00 2001 From: Florent Viard Date: Fri, 28 May 2021 10:29:41 +0200 Subject: [PATCH] [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. --- modules/bred/bred/pages.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/bred/bred/pages.py b/modules/bred/bred/pages.py index b95899545b..fd8fb046ee 100644 --- a/modules/bred/bred/pages.py +++ b/modules/bred/bred/pages.py @@ -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) -- GitLab