Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Small code refactor
Anna Siwik97f1f3a59c5c
diff --git a/saleor/order/utils.py b/saleor/order/utils.pyindex 2e5ceba162..ea60e37a07 100644--- a/saleor/order/utils.py+++ b/saleor/order/utils.py@@ -122,14 +122,14 @@ def add_variant_to_existing_lines(group, variant, total_quantity):quantity_left = total_quantityfor line in lines:- quantity_added = (+ quantity = (line.stock.quantity_availableif quantity_left > line.stock.quantity_availableelse quantity_left)- line.quantity += quantity_added+ line.quantity += quantityline.save()- Stock.objects.allocate_stock(line.stock, quantity_added)- quantity_left -= quantity_added+ Stock.objects.allocate_stock(line.stock, quantity)+ quantity_left -= quantityif quantity_left == 0:breakreturn quantity_leftdiff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.htmlindex 79d6f54d33..2ab3d9c070 100644--- a/templates/dashboard/order/detail.html+++ b/templates/dashboard/order/detail.html@@ -369,7 +369,7 @@</table></div>{% if perms.order.edit_order %}- {% if group.can_ship or group.can_cancel or group.can_edit_items %}+ {% if group.can_ship or group.can_cancel %}<div class="data-table-action">{% if group.can_ship %}<a href="#base-modal" data-href="{% url 'dashboard:ship-delivery-group' order_pk=order.pk group_pk=group.pk %}" class="btn btn-flat modal-trigger-custom">diff --git a/tests/conftest.py b/tests/conftest.pyindex 2eeca79b1d..6828500344 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -486,11 +486,9 @@ def product_list(product_class):product_1 = Product.objects.create(name='Test product 1', price=Decimal('10.00'),product_class=product_class, is_published=True)- ProductVariant.objects.create(product=product_1, sku='SKU_1')product_2 = Product.objects.create(name='Test product 2', price=Decimal('20.00'),product_class=product_class, is_published=False)- ProductVariant.objects.create(product=product_2, sku='SKU_2')return [product_1, product_2]