diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py
index 233349e554..478f5b6435 100644
--- a/InvenTree/part/api.py
+++ b/InvenTree/part/api.py
@@ -2088,9 +2088,6 @@ part_api_urls = [
# BOM download
re_path(r'^bom-download/?', views.BomDownload.as_view(), name='api-bom-download'),
- # Old pricing endpoint
- re_path(r'^pricing2/', views.PartPricing.as_view(), name='part-pricing'),
-
# Part detail endpoint
re_path(r'^.*$', PartDetail.as_view(), name='api-part-detail'),
])),
diff --git a/InvenTree/part/templates/part/part_pricing.html b/InvenTree/part/templates/part/part_pricing.html
deleted file mode 100644
index 52c7e44525..0000000000
--- a/InvenTree/part/templates/part/part_pricing.html
+++ /dev/null
@@ -1,127 +0,0 @@
-{% extends "modal_form.html" %}
-
-{% load i18n inventree_extras %}
-
-{% block pre_form_content %}
-
-{% default_currency as currency %}
-{% settings_value "PART_INTERNAL_PRICE" as show_internal_price %}
-
-
-
- {% trans 'Part' %} |
- {{ part }} |
-
-
- {% trans 'Quantity' %} |
- {{ quantity }} |
-
-
-
-{% if part.supplier_count > 0 %}
- {% trans 'Supplier Pricing' %}
-
- {% if min_total_buy_price %}
-
- {% trans 'Unit Cost' %} |
- Min: {% include "price.html" with price=min_unit_buy_price %} |
- Max: {% include "price.html" with price=max_unit_buy_price %} |
-
- {% if quantity > 1 %}
-
- {% trans 'Total Cost' %} |
- Min: {% include "price.html" with price=min_total_buy_price %} |
- Max: {% include "price.html" with price=max_total_buy_price %} |
-
- {% endif %}
- {% else %}
-
-
- {% trans 'No supplier pricing available' %}
- |
-
- {% endif %}
-
-{% endif %}
-
-{% if part.bom_count > 0 %}
- {% trans 'BOM Pricing' %}
-
- {% if min_total_bom_price %}
-
- {% trans 'Unit Cost' %} |
- Min: {% include "price.html" with price=min_unit_bom_price %} |
- Max: {% include "price.html" with price=max_unit_bom_price %} |
-
- {% if quantity > 1 %}
-
- {% trans 'Total Cost' %} |
- Min: {% include "price.html" with price=min_total_bom_price %} |
- Max: {% include "price.html" with price=max_total_bom_price %} |
-
- {% endif %}
- {% endif %}
- {% if min_total_bom_purchase_price %}
-
- {% trans 'Unit Purchase Price' %} |
- Min: {% include "price.html" with price=min_unit_bom_purchase_price %} |
- Max: {% include "price.html" with price=max_unit_bom_purchase_price %} |
-
- {% if quantity > 1 %}
-
- {% trans 'Total Purchase Price' %} |
- Min: {% include "price.html" with price=min_total_bom_purchase_price %} |
- Max: {% include "price.html" with price=max_total_bom_purchase_price %} |
-
- {% endif %}
- {% endif %}
-
- {% if min_total_bom_price or min_total_bom_purchase_price %}
- {% else %}
-
-
- {% trans 'No BOM pricing available' %}
- |
-
- {% endif %}
-
-{% endif %}
-
-{% if show_internal_price and roles.sales_order.view %}
-{% if total_internal_part_price %}
- {% trans 'Internal Price' %}
-
-
- {% trans 'Unit Cost' %} |
- {% include "price.html" with price=unit_internal_part_price %} |
-
-
- {% trans 'Total Cost' %} |
- {% include "price.html" with price=total_internal_part_price %} |
-
-
-{% endif %}
-{% 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 or min_unit_bom_purchase_price %}
-{% else %}
-
- {% trans 'No pricing information is available for this part.' %}
-
-{% endif %}
-
-{% endblock %}
diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py
index 93b0887164..da01b38125 100644
--- a/InvenTree/part/views.py
+++ b/InvenTree/part/views.py
@@ -12,7 +12,6 @@ from django.utils.translation import gettext_lazy as _
from django.views.generic import DetailView, ListView
from common.files import FileManager
-from common.models import InvenTreeSetting
from common.views import FileManagementAjaxView, FileManagementFormView
from company.models import SupplierPart
from InvenTree.helpers import str2bool, str2int
@@ -495,156 +494,6 @@ class BomDownload(AjaxView):
}
-class PartPricing(AjaxView):
- """View for inspecting part pricing information."""
-
- model = Part
- ajax_template_name = "part/part_pricing.html"
- ajax_form_title = _("Part Pricing")
- form_class = part_forms.PartPriceForm
-
- role_required = ['sales_order.view', 'part.view']
-
- def get_quantity(self):
- """Return set quantity in decimal format."""
- return Decimal(self.request.POST.get('quantity', 1))
-
- def get_part(self):
- """Return the Part instance associated with this view"""
- try:
- return Part.objects.get(id=self.kwargs['pk'])
- except Part.DoesNotExist:
- return None
-
- def get_pricing(self, quantity=1, currency=None):
- """Returns context with pricing information."""
- if quantity <= 0:
- quantity = 1
-
- # TODO - Capacity for price comparison in different currencies
- currency = None
-
- # Currency scaler
- scaler = Decimal(1.0)
-
- part = self.get_part()
-
- ctx = {
- 'part': part,
- 'quantity': quantity,
- 'currency': currency,
- }
-
- if part is None:
- return ctx
-
- # Supplier pricing information
- if part.supplier_count > 0:
- buy_price = part.get_supplier_price_range(quantity)
-
- if buy_price is not None:
- min_buy_price, max_buy_price = buy_price
-
- min_buy_price /= scaler
- max_buy_price /= scaler
-
- min_unit_buy_price = round(min_buy_price / quantity, 3)
- max_unit_buy_price = round(max_buy_price / quantity, 3)
-
- min_buy_price = round(min_buy_price, 3)
- max_buy_price = round(max_buy_price, 3)
-
- if min_buy_price:
- ctx['min_total_buy_price'] = min_buy_price
- ctx['min_unit_buy_price'] = min_unit_buy_price
-
- if max_buy_price:
- ctx['max_total_buy_price'] = max_buy_price
- ctx['max_unit_buy_price'] = max_unit_buy_price
-
- # BOM pricing information
- if part.bom_count > 0:
-
- use_internal = InvenTreeSetting.get_setting('PART_BOM_USE_INTERNAL_PRICE', False)
- bom_price = part.get_bom_price_range(quantity, internal=use_internal)
- purchase_price = part.get_bom_price_range(quantity, purchase=True)
-
- if bom_price is not None:
- min_bom_price, max_bom_price = bom_price
-
- min_bom_price /= scaler
- max_bom_price /= scaler
-
- if min_bom_price:
- ctx['min_total_bom_price'] = round(min_bom_price, 3)
- ctx['min_unit_bom_price'] = round(min_bom_price / quantity, 3)
-
- if max_bom_price:
- ctx['max_total_bom_price'] = round(max_bom_price, 3)
- ctx['max_unit_bom_price'] = round(max_bom_price / quantity, 3)
-
- if purchase_price is not None:
- min_bom_purchase_price, max_bom_purchase_price = purchase_price
-
- min_bom_purchase_price /= scaler
- max_bom_purchase_price /= scaler
- if min_bom_purchase_price:
- ctx['min_total_bom_purchase_price'] = round(min_bom_purchase_price, 3)
- ctx['min_unit_bom_purchase_price'] = round(min_bom_purchase_price / quantity, 3)
-
- if max_bom_purchase_price:
- ctx['max_total_bom_purchase_price'] = round(max_bom_purchase_price, 3)
- ctx['max_unit_bom_purchase_price'] = round(max_bom_purchase_price / quantity, 3)
-
- # internal part pricing information
- internal_part_price = part.get_internal_price(quantity)
- if internal_part_price is not None:
- ctx['total_internal_part_price'] = round(internal_part_price, 3)
- ctx['unit_internal_part_price'] = round(internal_part_price / quantity, 3)
-
- # 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_initials(self):
- """Returns initials for form."""
- return {'quantity': self.get_quantity()}
-
- def get(self, request, *args, **kwargs):
- """Perform custom GET action for this view"""
- init = self.get_initials()
- qty = self.get_quantity()
-
- return self.renderJsonResponse(request, self.form_class(initial=init), context=self.get_pricing(qty))
-
- def post(self, request, *args, **kwargs):
- """Perform custom POST action for this view"""
- currency = None
-
- quantity = self.get_quantity()
-
- # Retain quantity value set by user
- form = self.form_class(initial=self.get_initials())
-
- # TODO - How to handle pricing in different currencies?
- currency = None
-
- # check if data is set
- try:
- data = self.data
- except AttributeError:
- data = {}
-
- # Always mark the form as 'invalid' (the user may wish to keep getting pricing data)
- data['form_valid'] = False
-
- return self.renderJsonResponse(request, form, data=data, context=self.get_pricing(quantity, currency))
-
-
class CategoryDetail(InvenTreeRoleMixin, InvenTreePluginViewMixin, DetailView):
"""Detail view for PartCategory."""