Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Store variants in OrderItems
Marcin Gębala6371cf736684
diff --git a/saleor/order/migrations/0002_auto_20150715_0813.py b/saleor/order/migrations/0002_auto_20150715_0813.pynew file mode 100644index 0000000000..e7238f294e--- /dev/null+++ b/saleor/order/migrations/0002_auto_20150715_0813.py@@ -0,0 +1,20 @@+# -*- coding: utf-8 -*-+from __future__ import unicode_literals++from django.db import models, migrations+import django.db.models.deletion+++class Migration(migrations.Migration):++ dependencies = [+ ('order', '0001_initial'),+ ]++ operations = [+ migrations.AlterField(+ model_name='ordereditem',+ name='product',+ field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.SET_NULL, verbose_name='product', blank=True, to='product.ProductVariant', null=True),+ ),+ ]diff --git a/saleor/order/models.py b/saleor/order/models.pyindex 9a7ae7f82b..5db7248d41 100644--- a/saleor/order/models.py+++ b/saleor/order/models.py@@ -20,7 +20,7 @@ from prices import Pricefrom satchless.item import ItemSet, ItemLinefrom ..core.utils import build_absolute_uri-from ..product.models import Product+from ..product.models import Product, ProductVariantfrom ..userprofile.models import Address, Userfrom ..delivery import get_delivery@@ -205,7 +205,7 @@ class DeliveryGroup(models.Model, ItemSet):product_variant = item_line.productprice = item_line.get_price_per_item()self.items.create(- product=product_variant.product,+ product=product_variant,quantity=item_line.get_quantity(),unit_price_net=price.net,product_name=smart_text(product_variant),@@ -261,7 +261,7 @@ class OrderedItem(models.Model, ItemLine):delivery_group = models.ForeignKey(DeliveryGroup, related_name='items', editable=False)product = models.ForeignKey(- Product, blank=True, null=True, related_name='+',+ ProductVariant, blank=True, null=True, related_name='+',on_delete=models.SET_NULL,verbose_name=pgettext_lazy('OrderedItem field', 'product'))product_name = models.CharField(