| Line 358... |
Line 358... |
| 358 |
try:
|
358 |
try:
|
| 359 |
order_client = TransactionClient().get_client()
|
359 |
order_client = TransactionClient().get_client()
|
| 360 |
order = order_client.getOrder(order_id)
|
360 |
order = order_client.getOrder(order_id)
|
| 361 |
holdInventoryDetail = HoldInventoryDetail.query.filter_by(item_id = item_id, warehouse_id = warehouse_id, source = order.source).first()
|
361 |
holdInventoryDetail = HoldInventoryDetail.query.filter_by(item_id = item_id, warehouse_id = warehouse_id, source = order.source).first()
|
| 362 |
if holdInventoryDetail is not None:
|
362 |
if holdInventoryDetail is not None:
|
| 363 |
holdInventoryDetail.held = holdInventoryDetail.held -quantity
|
363 |
holdInventoryDetail.held = max(0, holdInventoryDetail.held -quantity)
|
| 364 |
current_inventory_snapshot = CurrentInventorySnapshot.get_by(item_id=item_id, warehouse_id=warehouse_id)
|
364 |
current_inventory_snapshot = CurrentInventorySnapshot.get_by(item_id=item_id, warehouse_id=warehouse_id)
|
| 365 |
if current_inventory_snapshot is not None:
|
365 |
if current_inventory_snapshot is not None:
|
| 366 |
if current_inventory_snapshot.held>0:
|
- |
|
| 367 |
current_inventory_snapshot.held = current_inventory_snapshot.held - quantity
|
366 |
current_inventory_snapshot.held = max(0, current_inventory_snapshot.held - quantity)
|
| 368 |
session.commit()
|
367 |
session.commit()
|
| 369 |
except:
|
368 |
except:
|
| 370 |
print "Unable to release hold Inventory for item_id " + str(item_id) + " warehouse_id " + str(warehouse_id) + " source " + str(source_id)
|
369 |
print "Unable to release hold Inventory for item_id " + str(item_id) + " warehouse_id " + str(warehouse_id) + " source " + str(source_id)
|
| 371 |
|
370 |
|
| 372 |
#**Update item availability cache**#
|
371 |
#**Update item availability cache**#
|
| Line 404... |
Line 403... |
| 404 |
try:
|
403 |
try:
|
| 405 |
order_client = TransactionClient().get_client()
|
404 |
order_client = TransactionClient().get_client()
|
| 406 |
order = order_client.getOrder(order_id)
|
405 |
order = order_client.getOrder(order_id)
|
| 407 |
holdInventoryDetail = HoldInventoryDetail.query.filter_by(item_id = item_id, warehouse_id = warehouse_id, source = order.source).first()
|
406 |
holdInventoryDetail = HoldInventoryDetail.query.filter_by(item_id = item_id, warehouse_id = warehouse_id, source = order.source).first()
|
| 408 |
if holdInventoryDetail is not None:
|
407 |
if holdInventoryDetail is not None:
|
| 409 |
holdInventoryDetail.held = holdInventoryDetail.held -quantity
|
408 |
holdInventoryDetail.held = max(0, holdInventoryDetail.held -quantity)
|
| 410 |
current_inventory_snapshot = CurrentInventorySnapshot.get_by(item_id=item_id, warehouse_id=warehouse_id)
|
409 |
current_inventory_snapshot = CurrentInventorySnapshot.get_by(item_id=item_id, warehouse_id=warehouse_id)
|
| 411 |
if current_inventory_snapshot is not None:
|
410 |
if current_inventory_snapshot is not None:
|
| 412 |
if current_inventory_snapshot.held>0:
|
- |
|
| 413 |
current_inventory_snapshot.held = current_inventory_snapshot.held - quantity
|
411 |
current_inventory_snapshot.held = max(0, current_inventory_snapshot.held - quantity)
|
| 414 |
session.commit()
|
412 |
session.commit()
|
| 415 |
except:
|
413 |
except:
|
| 416 |
print "Unable to release hold Inventory for item_id " + str(item_id) + " warehouse_id " + str(warehouse_id) + " source " + str(source_id)
|
414 |
print "Unable to release hold Inventory for item_id " + str(item_id) + " warehouse_id " + str(warehouse_id) + " source " + str(source_id)
|
| 417 |
|
415 |
|
| 418 |
order_client = TransactionClient().get_client()
|
416 |
order_client = TransactionClient().get_client()
|