Skip to content

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

Add migration

fowczarekb11e3ac30f38
diff --git a/saleor/product/migrations/0081_auto_20181218_0024.py b/saleor/product/migrations/0081_auto_20181218_0024.py
new file mode 100644
index 0000000000..2637c98825
--- /dev/null
+++ b/saleor/product/migrations/0081_auto_20181218_0024.py
@@ -0,0 +1,18 @@
+# Generated by Django 2.1.4 on 2018-12-18 06:24
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('product', '0080_auto_20181214_0440'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='product',
+ name='tax_rate',
+ field=models.CharField(blank=True, choices=[('accommodation', 'accommodation'), ('admission to cultural events', 'admission to cultural events'), ('admission to entertainment events', 'admission to entertainment events'), ('admission to sporting events', 'admission to sporting events'), ('advertising', 'advertising'), ('agricultural supplies', 'agricultural supplies'), ('baby foodstuffs', 'baby foodstuffs'), ('bikes', 'bikes'), ('books', 'books'), ('childrens clothing', 'childrens clothing'), ('domestic fuel', 'domestic fuel'), ('domestic services', 'domestic services'), ('e-books', 'e-books'), ('foodstuffs', 'foodstuffs'), ('hotels', 'hotels'), ('medical', 'medical'), ('newspapers', 'newspapers'), ('passenger transport', 'passenger transport'), ('pharmaceuticals', 'pharmaceuticals'), ('property renovations', 'property renovations'), ('restaurants', 'restaurants'), ('social housing', 'social housing'), ('standard', 'standard'), ('water', 'water')], default='standard', max_length=128),
+ ),
+ ]
diff --git a/saleor/product/models.py b/saleor/product/models.py
index 8ad835061e..c25e321012 100644
--- a/saleor/product/models.py
+++ b/saleor/product/models.py
@@ -129,7 +129,8 @@ class Product(SeoModel):
updated_at = models.DateTimeField(auto_now=True, null=True)
charge_taxes = models.BooleanField(default=True)
tax_rate = models.CharField(
- max_length=128, default=DEFAULT_TAX_RATE_NAME, blank=True)
+ max_length=128, default=DEFAULT_TAX_RATE_NAME, blank=True,
+ choices=TaxRateType.CHOICES)
weight = MeasurementField(
measurement=Weight, unit_choices=WeightUnits.CHOICES,
blank=True, null=True)
diff --git a/tests/api/test_product.py b/tests/api/test_product.py
index e130f427a9..73e4474221 100644
--- a/tests/api/test_product.py
+++ b/tests/api/test_product.py
@@ -467,7 +467,7 @@ def test_create_product(
assert data['product']['description'] == product_description
assert data['product']['isPublished'] == product_is_published
assert data['product']['chargeTaxes'] == product_charge_taxes
- assert data['product']['taxRate'] == product_tax_rate.lower()
+ assert data['product']['taxRate'] == product_tax_rate
assert data['product']['productType']['name'] == product_type.name
assert data['product']['category']['name'] == category.name
values = (
@@ -563,7 +563,7 @@ def test_update_product(
assert data['product']['description'] == product_description
assert data['product']['isPublished'] == product_isPublished
assert data['product']['chargeTaxes'] == product_chargeTaxes
- assert data['product']['taxRate'] == product_taxRate.lower()
+ assert data['product']['taxRate'] == product_taxRate
assert not data['product']['category']['name'] == category.name