Correctly handle amounts with commas
This commit is contained in:
parent
56959cda22
commit
4e180f5151
@ -63,12 +63,12 @@ def parse_amount(amount):
|
||||
if amount_str[0] in list('0123456789-'):
|
||||
# Commodity follows number
|
||||
bits = amount_str.split()
|
||||
amount_num = Decimal(bits[0])
|
||||
amount_num = Decimal(bits[0].replace(',', ''))
|
||||
commodity = Commodity(bits[1].strip('"'), False)
|
||||
else:
|
||||
# Commodity precedes number
|
||||
commodity = Commodity(amount_str[0], True)
|
||||
amount_num = Decimal(amount_str[1:])
|
||||
amount_num = Decimal(amount_str[1:].replace(',', ''))
|
||||
|
||||
if price_str:
|
||||
commodity.price = parse_amount(price_str)
|
||||
|
Reference in New Issue
Block a user