| Line 673... |
Line 673... |
| 673 |
'''
|
673 |
'''
|
| 674 |
if (item.isWarehousePreferenceSticky and item.preferredWarehouse is not None) :
|
674 |
if (item.isWarehousePreferenceSticky and item.preferredWarehouse is not None) :
|
| 675 |
warehouse_retid = item.preferredWarehouse
|
675 |
warehouse_retid = item.preferredWarehouse
|
| 676 |
warehouse = Warehouse.get_by(id=warehouse_retid)
|
676 |
warehouse = Warehouse.get_by(id=warehouse_retid)
|
| 677 |
logisticsLocation = warehouse.logisticsLocation
|
677 |
logisticsLocation = warehouse.logisticsLocation
|
| 678 |
total_availability = __get_item_availability(item, warehouse_ids)
|
678 |
total_availability = __get_item_availability(item, [warehouse_retid])
|
| 679 |
|
679 |
|
| 680 |
#If preference is not sticky then this order should be fulfilled from preferred WH if inventory available
|
680 |
#If preference is not sticky then this order should be fulfilled from preferred WH if inventory available
|
| 681 |
#otherwise we should check for its availability elsewhere and fulfil this order from there, but if it is not available anywhere
|
681 |
#otherwise we should check for its availability elsewhere and fulfil this order from there, but if it is not available anywhere
|
| 682 |
#then we should fulfil this order from its default warehouse.
|
682 |
#then we should fulfil this order from its default warehouse.
|
| 683 |
|
683 |
|
| Line 688... |
Line 688... |
| 688 |
except Exception as e:
|
688 |
except Exception as e:
|
| 689 |
print e
|
689 |
print e
|
| 690 |
availability = 0
|
690 |
availability = 0
|
| 691 |
if availability > 0:
|
691 |
if availability > 0:
|
| 692 |
warehouse_retid = item.preferredWarehouse
|
692 |
warehouse_retid = item.preferredWarehouse
|
| 693 |
total_availability = __get_item_availability(item, warehouse_ids)
|
693 |
total_availability = availability
|
| 694 |
else :
|
694 |
else :
|
| 695 |
[logisticsLocation, warehouse_retid, total_availability] = \
|
695 |
[logisticsLocation, warehouse_retid, total_availability] = \
|
| 696 |
__get_warehouse_with_max_availability(warehouse_loc = warehouse_loc, \
|
696 |
__get_warehouse_with_max_availability(warehouse_loc = warehouse_loc, \
|
| 697 |
warehouse_ids = warehouse_ids, item = item)
|
697 |
warehouse_ids = warehouse_ids, item = item)
|
| 698 |
|
698 |
|