def veto_out_of_stock(sender, cartitem=None, added_quantity=0, **kwargs):

    if config_value('PRODUCT','NO_STOCK_CHECKOUT') == False:
        product = cartitem.product
        need_qty = cartitem.quantity + added_quantity
        if product.items_in_stock < need_qty:
            log.debug('out of stock on %s', product.slug)
            raise OutOfStockError(product, product.items_in_stock, need_qty)
Listener which vetoes adding products to the cart which are out of stock.
dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/satchmo_store/shop/listeners.py/veto_out_of_stock