Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Show taxes on invoice
Anna Siwik831142d1512a
diff --git a/saleor/checkout/core.py b/saleor/checkout/core.pyindex 63dd6ba1dd..33b06e60a1 100644--- a/saleor/checkout/core.py+++ b/saleor/checkout/core.py@@ -325,7 +325,7 @@ class Checkout:for line in self.cart.lines.all():add_variant_to_order(order, line.variant, line.quantity, self.cart.discounts,- add_to_existing=False)+ self.taxes, add_to_existing=False)if voucher is not None:increase_voucher_usage(voucher)diff --git a/saleor/dashboard/order/forms.py b/saleor/dashboard/order/forms.pyindex a58f09c65f..14ff402d64 100644--- a/saleor/dashboard/order/forms.py+++ b/saleor/dashboard/order/forms.py@@ -565,6 +565,7 @@ class AddVariantToOrderForm(forms.Form):def __init__(self, *args, **kwargs):self.order = kwargs.pop('order')self.discounts = kwargs.pop('discounts')+ self.taxes = kwargs.pop('taxes')super().__init__(*args, **kwargs)def clean(self):@@ -593,7 +594,7 @@ class AddVariantToOrderForm(forms.Form):variant = self.cleaned_data.get('variant')quantity = self.cleaned_data.get('quantity')add_variant_to_order(- self.order, variant, quantity, self.discounts)+ self.order, variant, quantity, self.discounts, self.taxes)recalculate_order(self.order)diff --git a/saleor/dashboard/order/views.py b/saleor/dashboard/order/views.pyindex ab21444ba0..aee4942946 100644--- a/saleor/dashboard/order/views.py+++ b/saleor/dashboard/order/views.py@@ -293,7 +293,8 @@ def add_variant_to_order(request, order_pk):"""Add variant in given quantity to an order."""order = get_object_or_404(Order.objects.drafts(), pk=order_pk)form = AddVariantToOrderForm(- request.POST or None, order=order, discounts=request.discounts)+ request.POST or None, order=order, discounts=request.discounts,+ taxes=request.taxes)status = 200if form.is_valid():msg_dict = {diff --git a/saleor/order/utils.py b/saleor/order/utils.pyindex de1b46ea4d..d50c3667de 100644--- a/saleor/order/utils.py+++ b/saleor/order/utils.py@@ -129,7 +129,8 @@ def attach_order_to_user(order, user):def add_variant_to_order(- order, variant, total_quantity, discounts=None, add_to_existing=True):+ order, variant, total_quantity, discounts=None, taxes=None,+ add_to_existing=True):"""Add total_quantity of variant to order.Raises InsufficientStock exception if quantity could not be fulfilled.@@ -146,7 +147,7 @@ def add_variant_to_order(returnif quantity_not_fulfilled > variant.quantity_available:raise InsufficientStock(variant)- price = variant.get_price_per_item(discounts)+ price = variant.get_price_per_item(discounts, taxes=taxes)order.lines.create(product_name=variant.display_product(),product_sku=variant.sku,diff --git a/saleor/static/dashboard/scss/document.scss b/saleor/static/dashboard/scss/document.scssindex 639f8a90b8..b9f5698f15 100644--- a/saleor/static/dashboard/scss/document.scss+++ b/saleor/static/dashboard/scss/document.scss@@ -83,7 +83,7 @@ table {display: table;td, th {border: none;- padding: 15px 5px;+ padding: 5px;display: table-cell;text-align: left;vertical-align: middle;@@ -106,7 +106,7 @@ table {}td {height: 30px;- padding: 10px;+ padding: 5px;&:first-child {padding-left: 24px;}@@ -123,7 +123,7 @@ table {}th {height: 48px;- padding: 0 24px;+ padding: 0 5px;color: #757575;font-weight: 400;font-size: 12px;diff --git a/templates/checkout/details.html b/templates/checkout/details.htmlindex bd5f584117..17a9767a1b 100644--- a/templates/checkout/details.html+++ b/templates/checkout/details.html@@ -43,6 +43,14 @@</div></div>{% endfor %}+ <div class="row checkout__review__section">+ <div class="col-8">+ <p>{% trans "Total tax" context "Order review section title" %}</p>+ </div>+ <div class="col-4">+ <p class="float-right">{{ total.tax|amount:'html' }}</p>+ </div>+ </div><div class="row checkout__review__section"><div class="col-8"><p>{% trans "Shipment" context "Order review section" %}</p>@@ -64,12 +72,6 @@</div></div><div class="row checkout__review__section">- <div class="col-8">- <p>{% trans "Taxes" context "Order review section title" %}</p>- </div>- <div class="col-4">- <p class="float-right">{{ total.tax|amount:'html' }}</p>- </div><div class="col-8"><h3>{% trans "Total" context "Order review section title" %}</h3></div>diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.htmlindex 7b6235313e..0cd7e171c9 100644--- a/templates/dashboard/order/detail.html+++ b/templates/dashboard/order/detail.html@@ -283,7 +283,7 @@{% trans "Item" context "Order table header" %}</th><th class="right-align">- {% trans "Price" context "Order table header" %}+ {% trans "Price gross" context "Order table header" %}</th><th class="right-align">{% trans "Quantity" context "Order table header" %}@@ -341,7 +341,8 @@{% endfor %}<tr class="last-no-border"><td class="right-align" colspan="3">- <p>{% trans "Subtotal" context "Order subtotal" %}</p>+ <p>{% trans "Subtotal net" context "Order subtotal" %}</p>+ <p>{% trans "Total taxes" context "Order total taxes" %}</p><p>{% if perms.order.edit_order and order.is_draft %}<a href="#base-modal" data-href="{% url 'dashboard:order-shipping-edit' order_pk=order.pk %}"@@ -405,7 +406,8 @@<p><strong>{% trans "Grand total" context "Order totals header" %}</strong></p></td><td class="right-align">- <p>{{ order.get_subtotal.gross|amount:'html' }}</p>+ <p>{{ order.get_subtotal.net|amount:'html' }}</p>+ <p>{{ order.total.tax|amount:'html' }}</p><p>{{ order.shipping_price.gross|amount:'html' }}</p>{% if order.is_draft or order.discount_amount %}<p>{% discount_as_negative order.discount_amount html=True %}</p>diff --git a/templates/dashboard/order/pdf/invoice.html b/templates/dashboard/order/pdf/invoice.htmlindex a54b30e78a..9dedc83f96 100644--- a/templates/dashboard/order/pdf/invoice.html+++ b/templates/dashboard/order/pdf/invoice.html@@ -24,12 +24,12 @@<tr>{% if order.shipping_address %}<th align="left" width="50%">- {% trans "Shipping Details" context "Invoice table header" %}+ {% trans "Shipping address" context "Invoice shipping address" %}</th>{% endif %}{% if order.billing_address %}<th align="left" {% if order.shipping_address %} width="50%"{% endif %}>- {% trans "Billing Details" context "Invoice table header" %}+ {% trans "Billing address" context "Invoice billing address" %}</th>{% endif %}</tr>@@ -37,23 +37,13 @@<tbody><tr>{% if order.shipping_address %}- <td valign="top">- {% with order.shipping_address as address %}- <h2>- {% trans "Shipping address" context "Invoice shipping address" %}- </h2>- {% include 'dashboard/includes/_address.html' with address=address only %}- {% endwith %}+ <td>+ {% include 'dashboard/includes/_address.html' with address=order.shipping_address only %}</td>{% endif %}{% if order.billing_address %}- <td valign="top">- {% with order.billing_address as address %}- <h2>- {% trans "Billing address" context "Invoice billing address" %}- </h2>- {% include 'dashboard/includes/_address.html' with address=address only %}- {% endwith %}+ <td>+ {% include 'dashboard/includes/_address.html' with address=order.billing_address only %}</td>{% endif %}</tr>@@ -74,7 +64,10 @@{% trans "SKU" context "Shipment order table header" %}</th><th class="right-align">- {% trans "Price" context "Shipment order table header" %}+ {% trans "Price net" context "Shipment order table header" %}+ </th>+ <th class="right-align">+ {% trans "Price gross" context "Shipment order table header" %}</th><th class="right-align">{% trans "Quantity" context "Shipment order table header" %}@@ -93,6 +86,9 @@<td>{{ line.product_sku }}</td>+ <td class="right-align">+ {{ line.unit_price.net|amount:'html' }}+ </td><td class="right-align">{{ line.unit_price.gross|amount:'html' }}</td>@@ -112,10 +108,18 @@<tbody><tr><td class="wide">- {% trans "Subtotal" context "Order subtotal price" %}+ {% trans "Subtotal net" context "Order subtotal net price" %}+ </td>+ <td class="right-align">+ {{ order.get_subtotal.net|amount:'html' }}+ </td>+ </tr>+ <tr>+ <td>+ {% trans "Total taxes" context "Order total taxes header" %}</td><td class="right-align">- {{ order.get_subtotal.gross|amount:'html' }}+ {{ order.total.tax|amount:'html' }}</td></tr><tr>