예제 #1
0
def test_decrease_stock(product_in_stock):
    stock = product_in_stock.variants.first().stock.first()
    stock.quantity = 100
    stock.quantity_allocated = 80
    stock.save()
    decrease_stock(stock, 50)
    stock.refresh_from_db()
    assert stock.quantity == 50
    assert stock.quantity_allocated == 30
예제 #2
0
def test_decrease_stock(product_in_stock):
    stock = product_in_stock.variants.first().stock.first()
    stock.quantity = 100
    stock.quantity_allocated = 80
    stock.save()
    decrease_stock(stock, 50)
    stock.refresh_from_db()
    assert stock.quantity == 50
    assert stock.quantity_allocated == 30
예제 #3
0
def ship_delivery_group(group, tracking_number=''):
    """Ship delivery group and decrease stock levels."""
    for line in group.lines.all():
        if line.stock:
            decrease_stock(line.stock, line.quantity)
    group.tracking_number = tracking_number
예제 #4
0
def ship_delivery_group(group, tracking_number=''):
    """Ship delivery group and decrease stock levels."""
    for line in group.lines.all():
        if line.stock:
            decrease_stock(line.stock, line.quantity)
    group.tracking_number = tracking_number
예제 #5
0
def ship_delivery_group(group, tracking_number=''):
    """Ships delivery group by decreasing products in stocks."""
    for line in group.lines.all():
        if line.stock:
            decrease_stock(line.stock, line.quantity)
    group.tracking_number = tracking_number