Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
URL field as non required at start of creation process
Tomasz Szymanski797d8d6184f9
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex c357fdaf12..c3c02a1b4b 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -1858,7 +1858,7 @@ input IntRangeInput {type Invoice implements Node {id: ID!number: String- url: String!+ url: String}scalar JSONStringdiff --git a/saleor/order/migrations/0081_auto_20200318_1017.py b/saleor/order/migrations/0081_auto_20200323_0743.pysimilarity index 87%rename from saleor/order/migrations/0081_auto_20200318_1017.pyrename to saleor/order/migrations/0081_auto_20200323_0743.pyindex bb93041e24..f07919b352 100644--- a/saleor/order/migrations/0081_auto_20200318_1017.py+++ b/saleor/order/migrations/0081_auto_20200323_0743.py@@ -1,4 +1,4 @@-# Generated by Django 3.0.4 on 2020-03-18 15:17+# Generated by Django 3.0.4 on 2020-03-23 12:43import django.contrib.postgres.fields.jsonbfrom django.db import migrations, models@@ -46,4 +46,9 @@ class Migration(migrations.Migration):name="number",field=models.CharField(max_length=255, null=True),),+ migrations.AlterField(+ model_name="invoice",+ name="url",+ field=models.URLField(max_length=2048, null=True),+ ),]diff --git a/saleor/order/models.py b/saleor/order/models.pyindex c91e43d53d..39db65960e 100644--- a/saleor/order/models.py+++ b/saleor/order/models.py@@ -502,7 +502,7 @@ class Invoice(ModelWithMetadata):order = models.ForeignKey(Order, null=True, on_delete=models.SET_NULL)number = models.CharField(max_length=255, null=True)created = models.DateTimeField(null=True)- url = models.URLField(max_length=2048)+ url = models.URLField(null=True, max_length=2048)status = models.CharField(max_length=32, default=InvoiceStatus.PENDING)def update_invoice(self, number=None, url=None):diff --git a/tests/api/test_order.py b/tests/api/test_order.pyindex 8454e0bb79..4989875464 100644--- a/tests/api/test_order.py+++ b/tests/api/test_order.py@@ -2968,7 +2968,7 @@ def test_update_invoice_missing_number(content = get_graphql_content(response)invoice.refresh_from_db()assert content["data"]["updateInvoice"]["errors"][0]["field"] == "invoice"- assert invoice.url == ""+ assert invoice.url is Noneassert invoice.status == InvoiceStatus.PENDING