Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Test changing quantity_fulfilled
Anna Siwikd1db1a0e79ed
diff --git a/saleor/order/utils.py b/saleor/order/utils.pyindex 1694cbafab..8fb4862262 100644--- a/saleor/order/utils.py+++ b/saleor/order/utils.py@@ -178,7 +178,7 @@ def merge_duplicates_into_order_line(line):is_shipping_required=line.is_shipping_required)if lines.count() > 1:line.quantity = sum([line.quantity for line in lines])- line.save(update_fields=['quantity_fulfilled'])+ line.save(update_fields=['quantity'])lines.exclude(pk=line.pk).delete()diff --git a/tests/dashboard/test_order.py b/tests/dashboard/test_order.pyindex 301f276972..e7460d15f1 100644--- a/tests/dashboard/test_order.py+++ b/tests/dashboard/test_order.py@@ -472,11 +472,15 @@ def test_note_form_sent_email(def test_fulfill_order_line(order_with_lines_and_stock):order = order_with_lines_and_stockline = order.lines.first()+ quantity_fulfilled_before = line.quantity_fulfilledstock = line.stockstock_quantity_after = stock.quantity - line.quantity+fulfill_order_line(line, line.quantity)+stock.refresh_from_db()assert stock.quantity == stock_quantity_after+ assert line.quantity_fulfilled == quantity_fulfilled_before + line.quantitydef test_view_change_fulfillment_tracking(admin_client, fulfilled_order):diff --git a/tests/test_order.py b/tests/test_order.pyindex a90c1b63c2..1127b0c0d7 100644--- a/tests/test_order.py+++ b/tests/test_order.py@@ -164,6 +164,8 @@ def test_restock_order_lines(order_with_lines_and_stock):stock_2_quantity_allocated_before - line_2.quantity)assert line_1.stock.quantity == stock_1_quantity_beforeassert line_2.stock.quantity == stock_2_quantity_before+ assert line_1.quantity_fulfilled == 0+ assert line_2.quantity_fulfilled == 0def test_restock_fulfilled_order_lines(fulfilled_order):@@ -217,9 +219,15 @@ def test_cancel_order(fulfilled_order):def test_cancel_fulfillment(fulfilled_order):fulfillment = fulfilled_order.fulfillments.first()+ line_1 = fulfillment.lines.first()+ line_2 = fulfillment.lines.first()+cancel_fulfillment(fulfillment, restock=False)+assert fulfillment.status == FulfillmentStatus.CANCELEDassert fulfilled_order.status == OrderStatus.UNFULFILLED+ assert line_1.order_line.quantity_fulfilled == 0+ assert line_2.order_line.quantity_fulfilled == 0def test_update_order_status(fulfilled_order):