| Line 815... |
Line 815... |
| 815 |
warehouse = warehouses[warehouse_retid]
|
815 |
warehouse = warehouses[warehouse_retid]
|
| 816 |
billingWarehouseId = warehouse.billingWarehouseId
|
816 |
billingWarehouseId = warehouse.billingWarehouseId
|
| 817 |
|
817 |
|
| 818 |
# Fetching billing warehouse of a Good billable warehouse corresponding to the virtual one
|
818 |
# Fetching billing warehouse of a Good billable warehouse corresponding to the virtual one
|
| 819 |
if not warehouse.billingWarehouseId:
|
819 |
if not warehouse.billingWarehouseId:
|
| 820 |
for w in Warehouse.query.filter_by(vendor_id = warehouse.vendor_id, inventoryType = InventoryType._VALUES_TO_NAMES[InventoryType.GOOD], logisticsLocation=warehouse.logisticsLocation).all():
|
820 |
for w in Warehouse.query.filter_by(vendor_id = warehouse.vendor_id, inventoryType = InventoryType._VALUES_TO_NAMES[InventoryType.GOOD], state_id=warehouse.state_id).all():
|
| 821 |
if w.billingWarehouseId:
|
821 |
if w.billingWarehouseId:
|
| 822 |
billingWarehouseId = w.billingWarehouseId
|
822 |
billingWarehouseId = w.billingWarehouseId
|
| 823 |
break
|
823 |
break
|
| 824 |
|
824 |
|
| 825 |
expectedDelay = item.expectedDelay
|
825 |
expectedDelay = item.expectedDelay
|
| Line 849... |
Line 849... |
| 849 |
if entry.warehouse_id in ourGoodWarehouses and ourGoodWarehouses[entry.warehouse_id].billingWarehouseId == billingWarehouseId:
|
849 |
if entry.warehouse_id in ourGoodWarehouses and ourGoodWarehouses[entry.warehouse_id].billingWarehouseId == billingWarehouseId:
|
| 850 |
total_availability += entry.availability - entry.reserved - entry.held
|
850 |
total_availability += entry.availability - entry.reserved - entry.held
|
| 851 |
elif entry.warehouse_id in thirdpartyWarehouses:
|
851 |
elif entry.warehouse_id in thirdpartyWarehouses:
|
| 852 |
vendorId = thirdpartyWarehouses[entry.warehouse_id].vendor_id
|
852 |
vendorId = thirdpartyWarehouses[entry.warehouse_id].vendor_id
|
| 853 |
for goodWarehouse in ourGoodWarehouses.values():
|
853 |
for goodWarehouse in ourGoodWarehouses.values():
|
| 854 |
if goodWarehouse.vendor_id==vendorId and goodWarehouse.billingWarehouseId == billingWarehouseId and warehouse.logisticsLocation==goodWarehouse.logisticsLocation:
|
854 |
if goodWarehouse.vendor_id==vendorId and goodWarehouse.billingWarehouseId == billingWarehouseId and warehouse.state_id==goodWarehouse.state_id:
|
| 855 |
total_availability += entry.availability - entry.reserved - entry.held
|
855 |
total_availability += entry.availability - entry.reserved - entry.held
|
| 856 |
break
|
856 |
break
|
| 857 |
|
857 |
|
| 858 |
item_availability_cache = ItemAvailabilityCache.get_by(itemId=item_id, sourceId=source_id)
|
858 |
item_availability_cache = ItemAvailabilityCache.get_by(itemId=item_id, sourceId=source_id)
|
| 859 |
if item_availability_cache is None:
|
859 |
if item_availability_cache is None:
|