Commit b340e694 authored by Vincent Ardisson's avatar Vincent Ardisson Committed by Romain Bignon
Browse files

[societegenerale] some loans have no balance in the loan json

parent b673880f
......@@ -470,11 +470,15 @@ class item(ItemElement):
obj_id = Dict('idPrestation')
obj_type = Account.TYPE_LOAN
obj_label = Dict('libelle')
obj_currency = Dict('capitalRestantDu/devise')
obj_currency = Dict('capitalRestantDu/devise', default=NotAvailable)
obj__link_id = None
def obj_balance(self):
val = Decimal(Dict('capitalRestantDu/valeur')(self))
val = Dict('capitalRestantDu/valeur', default=NotAvailable)(self)
if val is NotAvailable:
return val
val = Decimal(val)
point = Decimal(Dict('capitalRestantDu/posDecimale')(self))
assert point >= 0
return val.scaleb(-point)
......@@ -482,4 +486,8 @@ def obj_balance(self):
def validate(self, obj):
assert obj.label
if obj.balance is NotAvailable:
# ... but the account may be in the main AccountsList anyway
self.logger.debug('skipping account %r %r due to missing balance',, obj.label)
return False
return True
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