Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
populateDB - align stock.allocated_quantity with value from allocations (#16903)
Maciej Korycinskie943173e5793
diff --git a/saleor/core/utils/random_data.py b/saleor/core/utils/random_data.pyindex e75fb4cc64..af88e7c8f8 100644--- a/saleor/core/utils/random_data.py+++ b/saleor/core/utils/random_data.py@@ -740,15 +740,17 @@ def create_fulfillments(order):fulfillment, _ = Fulfillment.objects.get_or_create(order=order)quantity = random.randrange(0, line.quantity) + 1allocation = line.allocations.get()- fulfillment.lines.create(- order_line=line, quantity=quantity, stock=allocation.stock- )+ stock = allocation.stock+ fulfillment.lines.create(order_line=line, quantity=quantity, stock=stock)line.quantity_fulfilled = quantityline.save(update_fields=["quantity_fulfilled"])allocation.quantity_allocated = F("quantity_allocated") - quantityallocation.save(update_fields=["quantity_allocated"])+ stock.quantity_allocated = F("quantity_allocated") - quantity+ stock.save(update_fields=["quantity_allocated"])+update_order_status(order)