Subversion Repositories SmartDukaan

Rev

Rev 501 | Rev 511 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 501 Rev 504
Line 373... Line 373...
373
        raise InventoryServiceException(101, "bad item_id")
373
        raise InventoryServiceException(101, "bad item_id")
374
    
374
    
375
    warehouse = get_Warehouse(warehouse_id)
375
    warehouse = get_Warehouse(warehouse_id)
376
    if not warehouse:
376
    if not warehouse:
377
        raise InventoryServiceException(108, "warehouse does not exist")
377
        raise InventoryServiceException(108, "warehouse does not exist")
378
    item = get_Item(item_id)
378
    item = get_item_by_catalog_id(item_id)
379
    
379
 
380
    if not item:
380
    if not item:
381
            raise InventoryServiceException(108, "item does not exist")
381
            raise InventoryServiceException(108, "item does not exist")
382
        
382
        
383
    query = CurrentInventorySnapshot.query.filter_by(warehouse_id = warehouse_id)
383
    query = CurrentInventorySnapshot.query.filter_by(warehouse_id = warehouse_id)
384
    query = query.filter_by(item_id = item_id)
384
    query = query.filter_by(item_id = item.id)
385
    try:
385
    try:
386
        current_inventory_snapshot = query.one()
386
        current_inventory_snapshot = query.one()
387
        return current_inventory_snapshot.availibility
387
        return current_inventory_snapshot.availibility
388
    except:
388
    except:
389
        return 0
389
        return 0