| Line 4479... |
Line 4479... |
| 4479 |
if not warehouse.billingWarehouseId:
|
4479 |
if not warehouse.billingWarehouseId:
|
| 4480 |
raise TransactionServiceException(119, "Shifting of warehouse allowed to warehouse with billing support only")
|
4480 |
raise TransactionServiceException(119, "Shifting of warehouse allowed to warehouse with billing support only")
|
| 4481 |
|
4481 |
|
| 4482 |
# If One gives a billing warehouse for warehouse shift, we should assign order to the GOOD warehouse
|
4482 |
# If One gives a billing warehouse for warehouse shift, we should assign order to the GOOD warehouse
|
| 4483 |
# present within it with maximum availability
|
4483 |
# present within it with maximum availability
|
| - |
|
4484 |
vendorWarehouse = None
|
| 4484 |
if warehouse.id == warehouse.billingWarehouseId:
|
4485 |
if warehouse.id == warehouse.billingWarehouseId:
|
| 4485 |
warehouses = inventoryClient.getWarehouses(None, InventoryType.GOOD, 0, 0, warehouse.id)
|
4486 |
warehouses = inventoryClient.getWarehouses(None, InventoryType.GOOD, 0, 0, warehouse.id)
|
| 4486 |
if warehouses:
|
4487 |
if warehouses:
|
| 4487 |
itemInventory = inventoryClient.getItemInventoryByItemId(lineitem.item_id)
|
4488 |
itemInventory = inventoryClient.getItemInventoryByItemId(lineitem.item_id)
|
| 4488 |
warehouse = warehouses[0]
|
4489 |
vendorWarehouse = warehouses[0]
|
| 4489 |
maxAvailability = 0
|
4490 |
maxAvailability = 0
|
| 4490 |
for goodWarehouse in warehouses:
|
4491 |
for goodWarehouse in warehouses:
|
| 4491 |
if itemInventory.availability.has_key(goodWarehouse.id) and maxAvailability < itemInventory.availability[goodWarehouse.id]:
|
4492 |
if itemInventory.availability.has_key(goodWarehouse.id) and maxAvailability < itemInventory.availability[goodWarehouse.id]:
|
| 4492 |
warehouse = goodWarehouse
|
4493 |
vendorWarehouse = goodWarehouse
|
| 4493 |
maxAvailability = itemInventory.availability[goodWarehouse.id]
|
4494 |
maxAvailability = itemInventory.availability[goodWarehouse.id]
|
| 4494 |
|
4495 |
|
| 4495 |
# Use preferred vendor's warehouse if not available anywhere
|
4496 |
# Use preferred vendor's warehouse if not available anywhere
|
| 4496 |
'''
|
4497 |
'''
|
| 4497 |
if not maxAvailability:
|
4498 |
if not maxAvailability:
|
| Line 4500... |
Line 4501... |
| 4500 |
for goodWarehouse in warehouses:
|
4501 |
for goodWarehouse in warehouses:
|
| 4501 |
if goodWarehouse.vendor.id == item.preferredVendor:
|
4502 |
if goodWarehouse.vendor.id == item.preferredVendor:
|
| 4502 |
warehouse = goodWarehouse
|
4503 |
warehouse = goodWarehouse
|
| 4503 |
'''
|
4504 |
'''
|
| 4504 |
else:
|
4505 |
else:
|
| 4505 |
raise TransactionServiceException(119, "Shifting of warehouse allowed to GOOD inventory type warehouse with billing support")
|
4506 |
pass
|
| 4506 |
|
4507 |
|
| - |
|
4508 |
#if vendorWarehouse is None or vendorWarehouse.billingWarehouseId != warehouse.id:
|
| - |
|
4509 |
#assign it to first vendorwarehouse available with
|
| 4507 |
#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)
|
4510 |
#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)
|
| 4508 |
if order.productCondition != ProductCondition.BAD:
|
4511 |
if order.productCondition != ProductCondition.BAD:
|
| 4509 |
inventoryClient.updateReservationForOrder(lineitem.item_id, warehouse.id, sourceId, order.id, to_java_date(order.created_timestamp), to_java_date(order.promised_shipping_time), lineitem.quantity)
|
4512 |
inventoryClient.updateReservationForOrder(lineitem.item_id, vendorWarehouse.id, sourceId, order.id, to_java_date(order.created_timestamp), to_java_date(order.promised_shipping_time), lineitem.quantity)
|
| 4510 |
#__update_inventory_reservation(order)
|
4513 |
#__update_inventory_reservation(order)
|
| 4511 |
if order.status == OrderStatus.ACCEPTED:
|
4514 |
if order.status == OrderStatus.ACCEPTED:
|
| 4512 |
__update_transfer_price(order, warehouse.id)
|
4515 |
__update_transfer_price(order, vendorWarehouse.id)
|
| 4513 |
order.warehouse_id = warehouse.billingWarehouseId
|
4516 |
order.warehouse_id = vendorWarehouse.billingWarehouseId
|
| 4514 |
order.fulfilmentWarehouseId = warehouse.id
|
4517 |
order.fulfilmentWarehouseId = vendorWarehouse.id
|
| 4515 |
session.commit()
|
4518 |
session.commit()
|
| 4516 |
return order
|
4519 |
return order
|
| 4517 |
|
4520 |
|
| 4518 |
def __update_transfer_price(order, warehouse_id):
|
4521 |
def __update_transfer_price(order, warehouse_id):
|
| 4519 |
lineitem = order.lineitems[0]
|
4522 |
lineitem = order.lineitems[0]
|
| Line 9550... |
Line 9553... |
| 9550 |
<p>
|
9553 |
<p>
|
| 9551 |
For any queries please call +918826894203.
|
9554 |
For any queries please call +918826894203.
|
| 9552 |
</p>
|
9555 |
</p>
|
| 9553 |
<p>
|
9556 |
<p>
|
| 9554 |
Warm Regards,<br />
|
9557 |
Warm Regards,<br />
|
| 9555 |
Saholic Team
|
9558 |
SmartDukaan Team
|
| 9556 |
</p>
|
9559 |
</p>
|
| 9557 |
</div>
|
9560 |
</div>
|
| 9558 |
</body>
|
9561 |
</body>
|
| 9559 |
</html>
|
9562 |
</html>
|
| 9560 |
"""
|
9563 |
"""
|