| Line 3977... |
Line 3977... |
| 3977 |
raise TransactionServiceException(119, "Shifting of warehouse allowed to warehouse with billing support only")
|
3977 |
raise TransactionServiceException(119, "Shifting of warehouse allowed to warehouse with billing support only")
|
| 3978 |
|
3978 |
|
| 3979 |
# If One gives a billing warehouse for warehouse shift, we should assign order to the GOOD warehouse
|
3979 |
# If One gives a billing warehouse for warehouse shift, we should assign order to the GOOD warehouse
|
| 3980 |
# present within it with maximum availability
|
3980 |
# present within it with maximum availability
|
| 3981 |
if warehouse.id == warehouse.billingWarehouseId:
|
3981 |
if warehouse.id == warehouse.billingWarehouseId:
|
| 3982 |
warehouses = inventoryClient.getWarehouses(None, InventoryType.GOOD, 0, 0, warehouse.id)
|
3982 |
warehouses = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, 0, 0, warehouse.id)
|
| 3983 |
if warehouses:
|
3983 |
if warehouses:
|
| 3984 |
itemInventory = inventoryClient.getItemInventoryByItemId(lineitem.item_id)
|
3984 |
itemInventory = inventoryClient.getItemInventoryByItemId(lineitem.item_id)
|
| 3985 |
warehouse = warehouses[0]
|
3985 |
warehouse = warehouses[0]
|
| 3986 |
maxAvailability = 0
|
3986 |
maxAvailability = 0
|
| 3987 |
for goodWarehouse in warehouses:
|
3987 |
for goodWarehouse in warehouses:
|
| 3988 |
if itemInventory.availability.has_key(goodWarehouse.id) and maxAvailability < itemInventory.availability[goodWarehouse.id]:
|
3988 |
if itemInventory.availability.has_key(goodWarehouse.id) and maxAvailability < itemInventory.availability[goodWarehouse.id]:
|
| 3989 |
warehouse = goodWarehouse
|
3989 |
warehouse = goodWarehouse
|
| 3990 |
maxAvailability = itemInventory.availability[goodWarehouse.id]
|
3990 |
maxAvailability = itemInventory.availability[goodWarehouse.id]
|
| 3991 |
|
3991 |
|
| 3992 |
# Use preferred vendor's warehouse if not available anywhere
|
3992 |
# Use preferred vendor's warehouse if not available anywhere
|
| - |
|
3993 |
'''
|
| 3993 |
if not maxAvailability:
|
3994 |
if not maxAvailability:
|
| 3994 |
item = catalog_client.getItem(lineitem.item_id)
|
3995 |
item = catalog_client.getItem(lineitem.item_id)
|
| 3995 |
if item.preferredVendor:
|
3996 |
if item.preferredVendor:
|
| 3996 |
for goodWarehouse in warehouses:
|
3997 |
for goodWarehouse in warehouses:
|
| 3997 |
if goodWarehouse.vendor.id == item.preferredVendor:
|
3998 |
if goodWarehouse.vendor.id == item.preferredVendor:
|
| 3998 |
warehouse = goodWarehouse
|
3999 |
warehouse = goodWarehouse
|
| - |
|
4000 |
'''
|
| 3999 |
else:
|
4001 |
else:
|
| 4000 |
raise TransactionServiceException(119, "Shifting of warehouse allowed to GOOD inventory type warehouse with billing support")
|
4002 |
raise TransactionServiceException(119, "Shifting of warehouse allowed to GOOD inventory type warehouse with billing support")
|
| 4001 |
|
4003 |
|
| 4002 |
#inventoryClient.reserveItemInWarehouse(lineitem.item_id, warehouse.id, sourceId, order.id, to_java_date(order.created_timestamp), to_java_date(order.promised_shipping_time), lineitem.quantity)
|
4004 |
#inventoryClient.reserveItemInWarehouse(lineitem.item_id, warehouse.id, sourceId, order.id, to_java_date(order.created_timestamp), to_java_date(order.promised_shipping_time), lineitem.quantity)
|
| 4003 |
if order.productCondition != ProductCondition.BAD:
|
4005 |
if order.productCondition != ProductCondition.BAD:
|