Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Code improvements
Anna Siwikf41c299b6e5e
diff --git a/saleor/core/utils/random_data.py b/saleor/core/utils/random_data.pyindex 96af7b72d0..6cc497bf02 100644--- a/saleor/core/utils/random_data.py+++ b/saleor/core/utils/random_data.py@@ -18,7 +18,7 @@ from ...account.utils import store_user_addressfrom ...discount import DiscountValueType, VoucherTypefrom ...discount.models import Sale, Voucherfrom ...order import OrderStatus-from ...order.models import Fulfillment, Order, OrderLine, Payment+from ...order.models import Fulfillment, Order, Paymentfrom ...product.models import (AttributeChoiceValue, Category, Collection, Product, ProductAttribute,ProductImage, ProductType, ProductVariant, Stock, StockLocation)@@ -392,8 +392,7 @@ def create_order_line(order):stock.quantity += quantitystock.quantity_allocated += quantitystock.save()- return OrderLine.objects.create(- order=order,+ return order.lines.create(product=product,product_name=product.name,product_sku=variant.sku,diff --git a/saleor/dashboard/order/forms.py b/saleor/dashboard/order/forms.pyindex bb2e94bc8d..c78055670c 100644--- a/saleor/dashboard/order/forms.py+++ b/saleor/dashboard/order/forms.py@@ -176,7 +176,7 @@ class ChangeQuantityForm(forms.ModelForm):class CancelOrderForm(forms.Form):"""Allow canceling an entire order.- Deallocates corresponding stocks for each order line.+ Deallocate or increase corresponding stocks for each order line."""restock = forms.BooleanField(initial=True, required=False)diff --git a/saleor/order/models.py b/saleor/order/models.pyindex 7f914e5b6d..800065e108 100644--- a/saleor/order/models.py+++ b/saleor/order/models.py@@ -154,7 +154,7 @@ class Order(models.Model):return self.status in statusesdef can_cancel(self):- return self.status == OrderStatus.UNFULFILLED+ return self.status != OrderStatus.CANCELEDclass OrderLine(models.Model):