Bankimport: Handle thousand seperator

This commit is contained in:
Raphael Michel
2016-09-19 19:23:36 +02:00
parent 8aa1d74609
commit 531d4b0ce9
2 changed files with 23 additions and 1 deletions

View File

@@ -65,7 +65,14 @@ def _get_unknown_transactions(event: Event, job: BankImportJob, data: list):
transactions = []
for row in data:
amount = amount_pattern.sub("", row['amount'].replace(",", "."))
amount = row['amount']
if ',' in amount and '.' in amount:
# Handle thousand-seperator , or .
if amount.find(',') < amount.find('.'):
amount = amount.replace(',', '')
else:
amount = amount.replace('.', '')
amount = amount_pattern.sub("", amount.replace(',', '.'))
try:
amount = Decimal(amount)
except: