Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add debug data to all prices
Anna Siwik9fdfaa19a04c
diff --git a/saleor/product/templatetags/price_ranges.py b/saleor/product/templatetags/price_ranges.pyindex e0030d41b0..113f91acb2 100644--- a/saleor/product/templatetags/price_ranges.py+++ b/saleor/product/templatetags/price_ranges.py@@ -1,5 +1,7 @@from django import template+from ...core.utils import DEFAULT_TAX_RATE_NAME+register = template.Library()@@ -23,3 +25,13 @@ def price_to_display(context, price, with_taxes=None):else:display_gross_prices = with_taxesreturn price.gross if display_gross_prices else price.net++[email protected]_tag()+def tax_value(taxes, tax_rate):+ """Return tax rate value for given tax rate type in current country."""+ if not taxes:+ return 0++ tax = taxes.get(tax_rate) or taxes.get(DEFAULT_TAX_RATE_NAME)+ return tax['value']diff --git a/templates/account/details.html b/templates/account/details.htmlindex 1770c98504..832ccaf6ec 100644--- a/templates/account/details.html+++ b/templates/account/details.html@@ -75,7 +75,11 @@{{ order.created }}</div><div class="col-md-2 col-4">- <span class="float-right">{{ order.total.gross|amount:'html' }}</span>+ <span class="float-right">+ {{ order.total.gross|amount:'html' }}+ </span>+ <br>+ ({{ order.total.net|amount:'html' }} + {{ order.total.tax|amount:'html' }} VAT)</div><div class="col-md-4 d-none d-md-block">{% render_order_status order.status order.get_status_display %}diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.htmlindex 6a28ac756f..6df01a6002 100644--- a/templates/dashboard/order/detail.html+++ b/templates/dashboard/order/detail.html@@ -283,12 +283,18 @@<th class="wide">{% trans "Item" context "Order table header" %}</th>+ <th class="right-align">+ {% trans "Price (debug)" context "Order table header" %}+ </th><th class="right-align">{% trans "Price" context "Order table header" %}</th><th class="right-align">{% trans "Quantity" context "Order table header" %}</th>+ <th class="right-align">+ {% trans "Total (debug)" context "Order table header" %}+ </th><th class="right-align">{% trans "Total" context "Order table header" %}</th>@@ -310,6 +316,9 @@{% endblocktrans %}</span></td>+ <td class="right-align">+ ({{ line.unit_price.net|amount:'html' }} + {{ line.unit_price.tax|amount:'html' }} VAT)+ </td><td class="right-align">{% price_to_display line.unit_price order.include_taxes_in_prices as price %}{{ price|amount:'html' }}@@ -336,6 +345,9 @@{{ line.quantity }}{% endif %}</td>+ <td class="right-align">+ ({{ line.get_total.net|amount:'html' }} + {{ line.get_total.tax|amount:'html' }} VAT)+ </td><td class="right-align">{% price_to_display line.get_total order.include_taxes_in_prices as price %}{{ price|amount:'html' }}@@ -343,9 +355,15 @@</tr>{% endfor %}<tr class="last-no-border">- <td class="right-align" colspan="3">- <p>{% trans "Subtotal net" context "Order subtotal" %}</p>- <p>{% trans "Total taxes" context "Order total taxes" %}</p>+ <td class="right-align" colspan="5">+ <p>+ {% if order.include_taxes_in_prices %}+ {% trans "Subtotal" context "Order subtotal" %}+ {% else %}+ {% trans "Subtotal net" context "Order subtotal" %}+ {% endif %}+ </p>+ <p>debug</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 %}"@@ -368,6 +386,14 @@{% endif %}{% endif %}</p>+ <p>debug</p>+ <p>+ {% if order.include_taxes_in_prices %}+ {% trans "Taxes (included)" context "Order total taxes" %}+ {% else %}+ {% trans "Taxes" context "Order total taxes" %}+ {% endif %}+ </p>{% if order.is_draft or order.discount_amount %}<p>{% if perms.order.edit_order and order.is_draft %}@@ -407,21 +433,31 @@</p>{% endif %}<p><strong>{% trans "Grand total" context "Order totals header" %}</strong></p>+ <p><strong>debug</strong></p></td><td class="right-align"><p>{% price_to_display order.get_subtotal order.include_taxes_in_prices as price %}{{ price|amount:'html' }}</p>- <p>{{ order.total.tax|amount:'html' }}</p>+ <p>+ ({{ order.get_subtotal.net|amount:'html' }} + {{ order.get_subtotal.tax|amount:'html' }} VAT)+ </p><p>{% price_to_display order.shipping_price order.include_taxes_in_prices as price %}{{ price|amount:'html' }}</p>+ <p>+ ({{ order.shipping_price.net|amount:'html' }} + {{ order.shipping_price.tax|amount:'html' }} VAT)+ </p>+ <p>{{ order.total.tax|amount:'html' }}</p>{% if order.is_draft or order.discount_amount %}<p>{% discount_as_negative order.discount_amount html=True %}</p>{% endif %}<p><strong>{{ order.total.gross|amount:'html' }}</strong></p>+ <p>+ <strong>({{ order.total.net|amount:'html' }} + {{ order.total.tax|amount:'html' }} VAT)</strong>+ </p></td></tr></tbody>diff --git a/templates/dashboard/order/list.html b/templates/dashboard/order/list.htmlindex 481b8169ad..02b882d589 100644--- a/templates/dashboard/order/list.html+++ b/templates/dashboard/order/list.html@@ -53,6 +53,9 @@{% trans "Payment status" context "Orders table header" as label %}{% sorting_header 'payment_status' label %}+ {% trans "Total (debug)" context "Orders table header" as label %}+ {% sorting_header 'total_debug' label %}+{% trans "Total" context "Orders table header" as label %}{% sorting_header 'total' label %}</tr>@@ -76,6 +79,9 @@<td>{% render_status order.get_last_payment_status order.get_last_payment_status_display %}</td>+ <td class="right-align">+ ({{ order.total.net|amount:'html' }} + {{ order.total.tax|amount:'html' }} VAT)+ </td><td class="right-align">{{ order.total.gross|amount:'html' }}</td>diff --git a/templates/order/_ordered_items_table.html b/templates/order/_ordered_items_table.htmlindex f678ad2556..a404535ac7 100644--- a/templates/order/_ordered_items_table.html+++ b/templates/order/_ordered_items_table.html@@ -68,18 +68,46 @@{% price_to_display line.get_total as price %}{{ price|amount:'html' }}</p>+ <p class="float-right">+ ({{ line.get_total.net|amount:'html' }} + {{ line.get_total.tax|amount:'html' }} VAT)+ </p></div></div></div></div></div>{% endfor %}++<div class="table__row">+ <div class="row">+ <div class="col-8 order-details__table-footer">+ <p>+ {% if request.site.settings.display_gross_prices %}+ {% trans "Subtotal" context "Order details subtotal row text" %}+ {% else %}+ {% trans "Subtotal net" context "Order details subtotal row text" %}+ {% endif %}+ </p>+ </div>+ <div class="col-4">+ <p class="float-right">+ {% price_to_display order.get_subtotal as price %}+ {{ price|amount:'html' }}+ </p>+ <br>+ <p class="float-right">+ ({{ order.get_subtotal.net|amount:'html' }} + {{ order.get_subtotal.tax|amount:'html' }} VAT)+ </p>+ </div>+ </div>+</div>+{% if order.is_shipping_required %}<div class="table__row"><div class="row"><div class="col-8 order-details__table-footer"><p>- {% trans "Shipping total" context "Order details shipment row text" %} ({{ order.shipping_method_name|default:"-" }})+ {% trans "Shipping" context "Order details shipment row text" %} ({{ order.shipping_method_name|default:"-" }})</p></div><div class="col-4">@@ -87,6 +115,10 @@{% price_to_display order.shipping_price as price %}{{ price|amount:'html' }}</p>+ <br>+ <p class="float-right">+ ({{ order.shipping_price.net|amount:'html' }} + {{ order.shipping_price.tax|amount:'html' }} VAT)+ </p></div></div></div>@@ -110,7 +142,13 @@<div class="table__row"><div class="row"><div class="col-8 order-details__table-footer">- <p>{% trans "Taxes" context "Order details taxes text" %}</p>+ <p>+ {% if request.site.settings.display_gross_prices %}+ {% trans "Taxes (included)" context "Order details taxes text" %}+ {% else %}+ {% trans "Taxes" context "Order details taxes text" %}+ {% endif %}+ </p></div><div class="col-4"><p class="float-right">{{ order.total.tax|amount:'html' }}</p>@@ -126,7 +164,11 @@</div></div><div class="col-4">- <p class="float-right">{{ order.total.gross|amount:'html' }}</p>+ <p class="float-right">+ {{ order.total.gross|amount:'html' }}+ <br>+ ({{ order.total.net|amount:'html' }} + {{ order.total.tax|amount:'html' }} VAT)+ </p></div></div></div>diff --git a/templates/product/details.html b/templates/product/details.htmlindex 32fd057032..2303ce8b00 100644--- a/templates/product/details.html+++ b/templates/product/details.html@@ -143,6 +143,18 @@{{ price|amount:'html' }}</small>{% endif %}+ <small>+ {% tax_value request.taxes product.tax_rate as tax_rate %}+ {% if request.site.settings.display_gross_prices %}+ {% blocktrans trimmed with tax_rate=tax_rate context "Product details page vat rate value" %}+ including {{ tax_rate }}% VAT+ {% endblocktrans %}+ {% else %}+ {% blocktrans trimmed with tax_rate=tax_rate context "Product details page vat rate value" %}+ excluding {{ tax_rate }}% VAT+ {% endblocktrans %}+ {% endif %}+ </small></h2>{% endif %}{% endif %}