Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add relation to stock and copy stock location in OrderedItem model
Artur Smętdbdbc0fd7c1e
diff --git a/saleor/order/migrations/0008_auto_20151026_0820.py b/saleor/order/migrations/0008_auto_20151026_0820.pynew file mode 100644index 0000000000..f27c1d1b9d--- /dev/null+++ b/saleor/order/migrations/0008_auto_20151026_0820.py@@ -0,0 +1,26 @@+# -*- coding: utf-8 -*-+from __future__ import unicode_literals++from django.db import migrations, models+import django.db.models.deletion+++class Migration(migrations.Migration):++ dependencies = [+ ('product', '0006_product_updated_at'),+ ('order', '0007_deliverygroup_tracking_number'),+ ]++ operations = [+ migrations.AddField(+ model_name='ordereditem',+ name='stock',+ field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to='product.Stock', null=True),+ ),+ migrations.AddField(+ model_name='ordereditem',+ name='stock_location',+ field=models.CharField(default='', max_length=100, verbose_name='stock location'),+ ),+ ]diff --git a/saleor/order/models.py b/saleor/order/models.pyindex 889b6cb8a7..e849e01cba 100644--- a/saleor/order/models.py+++ b/saleor/order/models.py@@ -291,6 +291,11 @@ class OrderedItem(models.Model, ItemLine):pgettext_lazy('OrderedItem field', 'product name'), max_length=128)product_sku = models.CharField(pgettext_lazy('OrderedItem field', 'sku'),max_length=32)+ stock_location = models.CharField(+ pgettext_lazy('OrderedItem field', 'stock location'), max_length=100,+ default='')+ stock = models.ForeignKey('product.Stock', on_delete=models.SET_NULL,+ null=True)quantity = models.IntegerField(pgettext_lazy('OrderedItem field', 'quantity'),validators=[MinValueValidator(0), MaxValueValidator(999)])