Skip to content

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

Revert "Store variants in OrderItems"

Marcin Gębala2958ba31e3a8
diff --git a/saleor/order/migrations/0002_auto_20150715_0813.py b/saleor/order/migrations/0002_auto_20150715_0813.py
deleted file mode 100644
index e7238f294e..0000000000
--- a/saleor/order/migrations/0002_auto_20150715_0813.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- 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.py
index 9f9e9058bd..89973fb422 100644
--- a/saleor/order/models.py
+++ b/saleor/order/models.py
@@ -21,7 +21,7 @@ from prices import Price
from satchless.item import ItemSet, ItemLine
from ..core.utils import build_absolute_uri
-from ..product.models import Product, ProductVariant
+from ..product.models import Product
from ..userprofile.models import Address, User
from ..delivery import get_delivery
@@ -206,7 +206,7 @@ class DeliveryGroup(models.Model, ItemSet):
product_variant = item_line.product
price = item_line.get_price_per_item()
self.items.create(
- product=product_variant,
+ product=product_variant.product,
quantity=item_line.get_quantity(),
unit_price_net=price.net,
product_name=smart_text(product_variant),
@@ -267,7 +267,7 @@ class OrderedItem(models.Model, ItemLine):
delivery_group = models.ForeignKey(
DeliveryGroup, related_name='items', editable=False)
product = models.ForeignKey(
- ProductVariant, blank=True, null=True, related_name='+',
+ Product, blank=True, null=True, related_name='+',
on_delete=models.SET_NULL,
verbose_name=pgettext_lazy('OrderedItem field', 'product'))
product_name = models.CharField(