Fix CSV handheld batch parser, to allow decimal amounts

This commit is contained in:
Lance Edgar 2017-01-12 14:13:39 -06:00
parent bd39a9b019
commit b4e70d43be

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2016 Lance Edgar
# Copyright © 2010-2017 Lance Edgar
#
# This file is part of Rattail.
#
@ -27,6 +27,7 @@ Handheld batch handler
from __future__ import unicode_literals, absolute_import
import csv
import decimal
from sqlalchemy import orm
@ -92,8 +93,8 @@ class HandheldBatchHandler(BatchHandler):
upc = GPC(entry['upc'], calc_check_digit='upc')
data.append((
upc,
int(entry['cases']) if entry['cases'] else None,
int(entry['units']) if entry['units'] else None,
decimal.Decimal(entry['cases']) if entry['cases'] else None,
decimal.Decimal(entry['units']) if entry['units'] else None,
))
with open(path, 'rb') as f: