Add "import batch" support for Square -> CORE-POS (TransactionDetail)

This commit is contained in:
Lance Edgar 2018-11-22 20:36:27 -06:00
parent 4193503719
commit fcd3c6e49d

View file

@ -59,6 +59,8 @@ class TransactionDetailImporter(FromSquare, corepos_importing.model.TransactionD
'total', 'total',
] ]
batches_supported = True
def setup(self): def setup(self):
super(TransactionDetailImporter, self).setup() super(TransactionDetailImporter, self).setup()
@ -129,6 +131,9 @@ class TransactionDetailImporter(FromSquare, corepos_importing.model.TransactionD
if card_number: if card_number:
card_number = int(card_number) card_number = int(card_number)
# description
description = csvrow['Item']
# quantity # quantity
quantity = float(csvrow['Qty']) quantity = float(csvrow['Qty'])
@ -161,11 +166,12 @@ class TransactionDetailImporter(FromSquare, corepos_importing.model.TransactionD
log.warning("cannot parse 'total' from: %s", csvrow['Net Sales']) log.warning("cannot parse 'total' from: %s", csvrow['Net Sales'])
return { return {
'_object_str': "({}) {}".format(upc, description),
'store_row_id': store_row_id, 'store_row_id': store_row_id,
'date_time': date_time, 'date_time': date_time,
'card_number': card_number, 'card_number': card_number,
'upc': upc, 'upc': upc,
'description': csvrow['Item'], 'description': description,
'quantity': quantity, 'quantity': quantity,
'unit_price': unit_price, 'unit_price': unit_price,
'discount': discount, 'discount': discount,