| Line 665... |
Line 665... |
| 665 |
# Putting NULL as transfer price for cases where its missing
|
665 |
# Putting NULL as transfer price for cases where its missing
|
| 666 |
if item_pricing is not None:
|
666 |
if item_pricing is not None:
|
| 667 |
order.lineitems[0].transfer_price = item_pricing.transferPrice
|
667 |
order.lineitems[0].transfer_price = item_pricing.transferPrice
|
| 668 |
|
668 |
|
| 669 |
# For Mahipal warehouse, we need to scan out items for every billed order
|
669 |
# For Mahipal warehouse, we need to scan out items for every billed order
|
| - |
|
670 |
if order.warehouse_id == 7:
|
| 670 |
if order.warehouse_id == 7 and lineitem.productGroup == "Handsets":
|
671 |
if lineitem.productGroup == "Handsets":
|
| 671 |
try:
|
672 |
try:
|
| 672 |
warehouse_client = WarehouseClient().get_client()
|
673 |
warehouse_client = WarehouseClient().get_client()
|
| 673 |
inventoryItem = warehouse_client.getInventoryItem(serialNumber)
|
674 |
inventoryItem = warehouse_client.getInventoryItem(serialNumber)
|
| 674 |
if (inventoryItem.itemId != item_id):
|
675 |
if (inventoryItem.itemId != item_id):
|
| 675 |
item = catalog_client.getItem(inventoryItem.itemId)
|
676 |
item = catalog_client.getItem(inventoryItem.itemId)
|
| 676 |
lineitem = order.lineitems[0]
|
677 |
lineitem = order.lineitems[0]
|
| 677 |
scanItemString = " ".join([item.brand, item.modelName, item.modelNumber, item.color])
|
678 |
scanItemString = " ".join([item.brand, item.modelName, item.modelNumber, item.color])
|
| 678 |
lineItemString = " ".join([lineitem.brand, lineitem.model_name, lineitem.model_number, lineitem.color])
|
679 |
lineItemString = " ".join([lineitem.brand, lineitem.model_name, lineitem.model_number, lineitem.color])
|
| 679 |
raise TransactionServiceException(110, 'Trying to scan ' + scanItemString + ' instead of ' + lineItemString)
|
680 |
raise TransactionServiceException(110, 'Trying to scan ' + scanItemString + ' instead of ' + lineItemString)
|
| 680 |
inventoryItem = warehouse_client.scanSerializedItemForOrder(serialNumber, ScanType.SALE, orderId, order.warehouse_id)
|
681 |
inventoryItem = warehouse_client.scanSerializedItemForOrder(serialNumber, ScanType.SALE, orderId, order.warehouse_id)
|
| 681 |
lineitem.transfer_price = inventoryItem.unitPrice
|
682 |
lineitem.transfer_price = inventoryItem.unitPrice
|
| 682 |
order.vendorId = inventoryItem.supplierId
|
683 |
order.vendorId = inventoryItem.supplierId
|
| 683 |
except WarehouseServiceException as e:
|
684 |
except WarehouseServiceException as e:
|
| 684 |
print sys.exc_info()[0]
|
685 |
print sys.exc_info()[0]
|
| 685 |
print 'Could not scan out orders due to: ' + e.message
|
686 |
print 'Could not scan out orders due to: ' + e.message
|
| 686 |
if e.exceptionType == ExceptionType.ILLEGAL_ARGUMENTS:
|
687 |
if e.exceptionType == ExceptionType.ILLEGAL_ARGUMENTS:
|
| 687 |
raise TransactionServiceException(110, e.message)
|
688 |
raise TransactionServiceException(110, e.message)
|
| 688 |
|
689 |
|
| 689 |
try:
|
690 |
try:
|
| 690 |
catalog_client = CatalogClient().get_client()
|
691 |
catalog_client = CatalogClient().get_client()
|
| 691 |
for lineitem in lineitems:
|
692 |
for lineitem in lineitems:
|
| 692 |
catalog_client.reduceReservationCount(item_id, order.warehouse_id, lineitem.quantity)
|
693 |
catalog_client.reduceReservationCount(item_id, order.warehouse_id, lineitem.quantity)
|