| Line 628... |
Line 628... |
| 628 |
|
628 |
|
| 629 |
query = CurrentInventorySnapshot.query.filter_by(warehouse_id = warehouse_id, item_id = item_id)
|
629 |
query = CurrentInventorySnapshot.query.filter_by(warehouse_id = warehouse_id, item_id = item_id)
|
| 630 |
try:
|
630 |
try:
|
| 631 |
current_inventory_snapshot = query.one()
|
631 |
current_inventory_snapshot = query.one()
|
| 632 |
current_inventory_snapshot.reserved = current_inventory_snapshot.reserved - quantity
|
632 |
current_inventory_snapshot.reserved = current_inventory_snapshot.reserved - quantity
|
| 633 |
##FIXME In case of our own warehouse reduce availability also
|
- |
|
| 634 |
if warehouse_id == 7:
|
- |
|
| 635 |
current_inventory_snapshot.availibility = current_inventory_snapshot.availibility - quantity
|
- |
|
| 636 |
session.commit()
|
633 |
session.commit()
|
| 637 |
check_risky_item(item)
|
634 |
check_risky_item(item)
|
| 638 |
if current_inventory_snapshot.reserved < 0:
|
635 |
if current_inventory_snapshot.reserved < 0:
|
| 639 |
__send_alert_for_negative_reserved(get_item(item_id), current_inventory_snapshot.reserved, get_Warehouse(warehouse_id))
|
636 |
__send_alert_for_negative_reserved(get_item(item_id), current_inventory_snapshot.reserved, get_Warehouse(warehouse_id))
|
| 640 |
return True
|
637 |
return True
|