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
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
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