Fix CSV handheld batch parser, to allow decimal amounts
This commit is contained in:
		
							parent
							
								
									bd39a9b019
								
							
						
					
					
						commit
						b4e70d43be
					
				
					 1 changed files with 4 additions and 3 deletions
				
			
		|  | @ -2,7 +2,7 @@ | ||||||
| ################################################################################ | ################################################################################ | ||||||
| # | # | ||||||
| #  Rattail -- Retail Software Framework | #  Rattail -- Retail Software Framework | ||||||
| #  Copyright © 2010-2016 Lance Edgar | #  Copyright © 2010-2017 Lance Edgar | ||||||
| # | # | ||||||
| #  This file is part of Rattail. | #  This file is part of Rattail. | ||||||
| # | # | ||||||
|  | @ -27,6 +27,7 @@ Handheld batch handler | ||||||
| from __future__ import unicode_literals, absolute_import | from __future__ import unicode_literals, absolute_import | ||||||
| 
 | 
 | ||||||
| import csv | import csv | ||||||
|  | import decimal | ||||||
| 
 | 
 | ||||||
| from sqlalchemy import orm | from sqlalchemy import orm | ||||||
| 
 | 
 | ||||||
|  | @ -92,8 +93,8 @@ class HandheldBatchHandler(BatchHandler): | ||||||
|                 upc = GPC(entry['upc'], calc_check_digit='upc') |                 upc = GPC(entry['upc'], calc_check_digit='upc') | ||||||
|                 data.append(( |                 data.append(( | ||||||
|                     upc, |                     upc, | ||||||
|                     int(entry['cases']) if entry['cases'] else None, |                     decimal.Decimal(entry['cases']) if entry['cases'] else None, | ||||||
|                     int(entry['units']) if entry['units'] else None, |                     decimal.Decimal(entry['units']) if entry['units'] else None, | ||||||
|                 )) |                 )) | ||||||
| 
 | 
 | ||||||
|             with open(path, 'rb') as f: |             with open(path, 'rb') as f: | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar