Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Small code refactor

Anna Siwik97f1f3a59c5c
diff --git a/saleor/order/utils.py b/saleor/order/utils.py
index 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_quantity
for line in lines:
- quantity_added = (
+ quantity = (
line.stock.quantity_available
if quantity_left > line.stock.quantity_available
else quantity_left)
- line.quantity += quantity_added
+ line.quantity += quantity
line.save()
- Stock.objects.allocate_stock(line.stock, quantity_added)
- quantity_left -= quantity_added
+ Stock.objects.allocate_stock(line.stock, quantity)
+ quantity_left -= quantity
if quantity_left == 0:
break
return quantity_left
diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.html
index 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.py
index 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]