From 030865f8dd96b45f621c80b5833301786b004c35 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 5 May 2021 23:49:04 +0200 Subject: [PATCH] sale price in pricing table --- InvenTree/part/templates/part/part_pricing.html | 14 ++++++++++++++ InvenTree/part/views.py | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/InvenTree/part/templates/part/part_pricing.html b/InvenTree/part/templates/part/part_pricing.html index 9922813210..df43ed8799 100644 --- a/InvenTree/part/templates/part/part_pricing.html +++ b/InvenTree/part/templates/part/part_pricing.html @@ -79,6 +79,20 @@ {% endif %} +{% if total_part_price %} +

{% trans 'Sale Price' %}

+ + + + + + + + + +
{% trans 'Unit Cost' %}{% include "price.html" with price=unit_part_price %}
{% trans 'Total Cost' %}{% include "price.html" with price=total_part_price %}
+{% endif %} + {% if min_unit_buy_price or min_unit_bom_price %} {% else %}
diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index b7bebb6d05..5af90cb383 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -2055,6 +2055,12 @@ class PartPricing(AjaxView): ctx['max_total_bom_price'] = max_bom_price ctx['max_unit_bom_price'] = max_unit_bom_price + # part pricing information + part_price = part.get_price(quantity) + if part_price is not None: + ctx['total_part_price'] = round(part_price, 3) + ctx['unit_part_price'] = round(part_price / quantity, 3) + return ctx def get(self, request, *args, **kwargs):