| Line 664... |
Line 664... |
| 664 |
order.status = OrderStatus.BILLED
|
664 |
order.status = OrderStatus.BILLED
|
| 665 |
order.statusDescription = "Order Billed"
|
665 |
order.statusDescription = "Order Billed"
|
| 666 |
order.billing_timestamp = datetime.datetime.now()
|
666 |
order.billing_timestamp = datetime.datetime.now()
|
| 667 |
order.billed_by = billedBy
|
667 |
order.billed_by = billedBy
|
| 668 |
|
668 |
|
| 669 |
# Not letting the billing process fail in cases where we are unable to
|
669 |
# Letting the billing process fail in cases where we are unable to
|
| 670 |
# fill in transfer price
|
670 |
# fill in transfer price
|
| 671 |
try:
|
671 |
try:
|
| 672 |
catalog_client = CatalogClient().get_client()
|
672 |
catalog_client = CatalogClient().get_client()
|
| 673 |
warehouse = catalog_client.getWarehouse(fulfilmentWarehouseId)
|
673 |
warehouse = catalog_client.getWarehouse(fulfilmentWarehouseId)
|
| 674 |
item_pricing = catalog_client.getItemPricing(item_id, warehouse.vendor.id)
|
674 |
item_pricing = catalog_client.getItemPricing(item_id, warehouse.vendor.id)
|
| Line 682... |
Line 682... |
| 682 |
# For OUR warehouse, we need to scan out items for every billed order
|
682 |
# For OUR warehouse, we need to scan out items for every billed order
|
| 683 |
if billingType == BillingType.OURS:
|
683 |
if billingType == BillingType.OURS:
|
| 684 |
for serialNumber in serialNumbers:
|
684 |
for serialNumber in serialNumbers:
|
| 685 |
try:
|
685 |
try:
|
| 686 |
warehouse_client = WarehouseClient().get_client()
|
686 |
warehouse_client = WarehouseClient().get_client()
|
| - |
|
687 |
# Fetching GOOD w/h corresponding to the virtual one here
|
| - |
|
688 |
if warehouse.billingWarehouseId is None:
|
| - |
|
689 |
warehouse = catalog_client.getWarehouses(None, InventoryType.GOOD, warehouse.vendor.id, order.warehouse_id, 0)[0]
|
| - |
|
690 |
order.fulfilmentWarehouseId = warehouse.id
|
| - |
|
691 |
|
| 687 |
if ItemType.SERIALIZED == item.type:
|
692 |
if ItemType.SERIALIZED == item.type:
|
| 688 |
inventoryItem = warehouse_client.getInventoryItem(serialNumber)
|
693 |
inventoryItem = warehouse_client.getInventoryItem(serialNumber)
|
| 689 |
else:
|
694 |
else:
|
| 690 |
inventoryItem = warehouse_client.getNonSeralizedInventoryItem(item_id, order.fulfilmentWarehouseId)
|
695 |
inventoryItem = warehouse_client.getNonSeralizedInventoryItem(item_id, order.fulfilmentWarehouseId)
|
| 691 |
|
696 |
|
| Line 702... |
Line 707... |
| 702 |
inventoryItem = warehouse_client.scanForOrder(inventoryItem, ScanType.SALE, 1, order.id, order.fulfilmentWarehouseId, order.warehouse_id)
|
707 |
inventoryItem = warehouse_client.scanForOrder(inventoryItem, ScanType.SALE, 1, order.id, order.fulfilmentWarehouseId, order.warehouse_id)
|
| 703 |
|
708 |
|
| 704 |
lineitem.transfer_price = inventoryItem.unitPrice
|
709 |
lineitem.transfer_price = inventoryItem.unitPrice
|
| 705 |
order.vendorId = inventoryItem.supplierId
|
710 |
order.vendorId = inventoryItem.supplierId
|
| 706 |
catalog_client = CatalogClient().get_client()
|
711 |
catalog_client = CatalogClient().get_client()
|
| 707 |
warehouse = catalog_client.getWarehouse(order.fulfilmentWarehouseId)
|
- |
|
| 708 |
# Fetching GOOD w/h corresponding to the virtual one here
|
- |
|
| 709 |
if warehouse.billingWarehouseId is None:
|
- |
|
| 710 |
warehouse = catalog_client.getWarehouses(None, InventoryType.GOOD, warehouse.vendor.id, order.warehouse_id, 0)[0]
|
- |
|
| 711 |
order.fulfilmentWarehouseId = warehouse.id
|
- |
|
| 712 |
except WarehouseServiceException as e:
|
712 |
except WarehouseServiceException as e:
|
| 713 |
print sys.exc_info()[0]
|
713 |
print sys.exc_info()[0]
|
| 714 |
print 'Could not scan out orders due to: ' + e.message
|
714 |
print 'Could not scan out orders due to: ' + e.message
|
| 715 |
raise TransactionServiceException(110, e.message)
|
715 |
raise TransactionServiceException(110, e.message)
|
| 716 |
else:
|
716 |
else:
|