Skip to content

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

Tests modifications, design fixes

Tomasz Szymanski80565ff721bb
diff --git a/saleor/order/utils.py b/saleor/order/utils.py
index 4acafbfd7a..abcb3eb1d0 100644
--- a/saleor/order/utils.py
+++ b/saleor/order/utils.py
@@ -3,7 +3,6 @@ from uuid import uuid4
from django.conf import settings
from django.contrib.staticfiles import finders as static_finders
-from django.core.exceptions import ValidationError
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
from django.db import transaction
@@ -12,9 +11,6 @@ from django.utils import timezone
from prices import Money, TaxedMoney
from weasyprint import HTML
-from saleor.graphql.order.enums import InvoiceStatus
-from saleor.order.error_codes import InvoiceErrorCode
-
from ..account.models import User
from ..core.taxes import zero_money
from ..core.weight import zero_weight
@@ -373,23 +369,6 @@ def generate_invoice_pdf_for_order(invoice):
logo_path = static_finders.find("images/logo.svg")
MAX_PRODUCTS_PER_PAGE = 13
- if not getattr(invoice, "order"):
- raise ValidationError(
- {
- "order": ValidationError(
- "Invice order is invalid.", code=InvoiceErrorCode.REQUIRED
- )
- }
- )
- if invoice.status != InvoiceStatus.READY:
- raise ValidationError(
- {
- "status": ValidationError(
- "Invoice is not ready.", code=InvoiceErrorCode.NOT_READY
- )
- }
- )
-
all_products = invoice.order.lines.all()
product_limit_first_page = get_product_limit_first_page(all_products)
diff --git a/templates/invoice.html b/templates/invoice.html
index 9095cd62a9..613a05051b 100644
--- a/templates/invoice.html
+++ b/templates/invoice.html
@@ -6,7 +6,6 @@
<head>
<style>
@page {
- background-color: #FAFAFA;
margin: 0.5cm;
@bottom-right {
content: counter(page) " of " counter(pages);
@@ -85,7 +84,7 @@
.normal-text {
font-size: 14px;
color: #28234A;
- line-height: 1.4;
+ line-height: 1.7;
}
.summary-row {
@@ -112,7 +111,7 @@
.row-category > td,
.row-product > td {
padding: 7px 0 7px 0;
- border-bottom: 2px solid #EFF5F8;
+ border-bottom: 2px solid #CEE3ED;
}
.cell-product {
@@ -143,7 +142,7 @@
.content-separator {
display: inline-block;
width: 100%;
- border-bottom: 2px solid #EFF5F8;
+ border-bottom: 2px solid #CEE3ED;
}
.page-break {
diff --git a/tests/test_order.py b/tests/test_order.py
index 8f753aa158..f6a50cdfa9 100644
--- a/tests/test_order.py
+++ b/tests/test_order.py
@@ -4,7 +4,6 @@ from unittest.mock import MagicMock, Mock, patch
from uuid import UUID
import pytest
-from django.core.exceptions import ValidationError
from prices import Money, TaxedMoney
from saleor.core.weight import zero_weight
@@ -15,7 +14,6 @@ from saleor.discount.models import (
VoucherType,
)
from saleor.discount.utils import validate_voucher_in_order
-from saleor.graphql.order.enums import InvoiceStatus
from saleor.order import OrderEvents, OrderStatus, models
from saleor.order.emails import send_fulfillment_confirmation_to_customer
from saleor.order.events import OrderEvent, OrderEventsEmails, email_sent_event
@@ -777,23 +775,3 @@ def test_generate_invoice_pdf_for_order(
file_name, extension = storage_mock.save.call_args[0][0].split(".")
assert UUID(file_name, version=4)
assert extension == "pdf"
-
-
-def test_generate_invoice_pdf_for_invalid_order(fulfilled_order):
- invoice = fulfilled_order.invoices.first()
- invoice.order = None
-
- with pytest.raises(ValidationError) as error:
- generate_invoice_pdf_for_order(invoice)
-
- assert error.value.message_dict == {"order": ["Invice order is invalid."]}
-
-
-def test_generate_invoice_pdf_for_pending_invoice(fulfilled_order):
- invoice = fulfilled_order.invoices.first()
- invoice.status = InvoiceStatus.PENDING
-
- with pytest.raises(ValidationError) as error:
- generate_invoice_pdf_for_order(invoice)
-
- assert error.value.message_dict == {"status": ["Invoice is not ready."]}