diff --git a/InvenTree/company/api.py b/InvenTree/company/api.py
index f7bf9acc3f..2ab51af4a0 100644
--- a/InvenTree/company/api.py
+++ b/InvenTree/company/api.py
@@ -81,7 +81,8 @@ class SupplierPartList(generics.ListCreateAPIView):
'part__stock_items',
'part__bom_items',
'part__builds',
- 'supplier')
+ 'supplier',
+ 'pricebreaks')
serializer_class = SupplierPartSerializer
diff --git a/InvenTree/company/models.py b/InvenTree/company/models.py
index 5c3b3291ff..be59c2b66f 100644
--- a/InvenTree/company/models.py
+++ b/InvenTree/company/models.py
@@ -239,6 +239,10 @@ class SupplierPart(models.Model):
""" Return the associated price breaks in the correct order """
return self.pricebreaks.order_by('quantity').all()
+ @property
+ def unit_pricing(self):
+ return self.get_price(1)
+
def get_price(self, quantity, moq=True, multiples=True):
""" Calculate the supplier price based on quantity price breaks.
diff --git a/InvenTree/company/serializers.py b/InvenTree/company/serializers.py
index b09bccd234..f09c170661 100644
--- a/InvenTree/company/serializers.py
+++ b/InvenTree/company/serializers.py
@@ -62,6 +62,8 @@ class SupplierPartSerializer(serializers.ModelSerializer):
supplier_name = serializers.CharField(source='supplier.name', read_only=True)
supplier_logo = serializers.CharField(source='supplier.get_image_url', read_only=True)
+ pricing = serializers.CharField(source='unit_pricing', read_only=True)
+
class Meta:
model = SupplierPart
fields = [
@@ -76,6 +78,7 @@ class SupplierPartSerializer(serializers.ModelSerializer):
'manufacturer',
'MPN',
'URL',
+ 'pricing',
]
diff --git a/InvenTree/part/templates/part/part_pricing.html b/InvenTree/part/templates/part/part_pricing.html
index 6d82549bb2..55d68f06e2 100644
--- a/InvenTree/part/templates/part/part_pricing.html
+++ b/InvenTree/part/templates/part/part_pricing.html
@@ -3,7 +3,8 @@
{% block pre_form_content %}
-Calculate pricing information for {{ part }}.
+Pricing information for:
+{{ part }}.
Quantity
diff --git a/InvenTree/part/templates/part/stock.html b/InvenTree/part/templates/part/stock.html
index 68b89bf1b9..93c3be29f8 100644
--- a/InvenTree/part/templates/part/stock.html
+++ b/InvenTree/part/templates/part/stock.html
@@ -57,6 +57,15 @@
title: 'Create New Part',
url: "{% url 'part-create' %}",
},
+ {
+ field: 'supplier_part',
+ label: 'New Supplier Part',
+ title: 'Create new Supplier Part',
+ url: "{% url 'supplier-part-create' %}",
+ data: {
+ part: {{ part.id }}
+ },
+ },
{
field: 'location',
label: 'New Location',
diff --git a/InvenTree/part/templates/part/supplier.html b/InvenTree/part/templates/part/supplier.html
index 041d1fd8c7..ea5baa2759 100644
--- a/InvenTree/part/templates/part/supplier.html
+++ b/InvenTree/part/templates/part/supplier.html
@@ -38,11 +38,21 @@
$('#supplier-create').click(function () {
launchModalForm(
- "{% url 'supplier-part-create' %}",
- {
- reload: true,
- data: {part: {{ part.id }} }
- });
+ "{% url 'supplier-part-create' %}",
+ {
+ reload: true,
+ data: {
+ part: {{ part.id }}
+ },
+ secondary: [
+ {
+ field: 'supplier',
+ label: 'New Supplier',
+ title: 'Create new supplier',
+ url: "{% url 'company-create' %}"
+ }
+ ]
+ });
});
$("#supplier-table").bootstrapTable({
@@ -83,6 +93,18 @@
sortable: true,
field: 'MPN',
title: 'MPN',
+ },
+ {
+ sortable: true,
+ field: 'pricing',
+ title: 'Price',
+ formatter: function(value, row, index, field) {
+ if (value) {
+ return value;
+ } else {
+ return "No pricing available";
+ }
+ },
}
],
url: "{% url 'api-part-supplier-list' %}"
diff --git a/InvenTree/static/css/inventree.css b/InvenTree/static/css/inventree.css
index ff7ac4e98b..f4d4bdd26a 100644
--- a/InvenTree/static/css/inventree.css
+++ b/InvenTree/static/css/inventree.css
@@ -226,6 +226,10 @@
padding-bottom: 3px;
}
+.modal .btn-secondary {
+ background-color: #5e7d87;
+}
+
/* The side navigation menu */
.sidenav {
height: 100%; /* 100% Full-height */
diff --git a/InvenTree/static/script/inventree/modals.js b/InvenTree/static/script/inventree/modals.js
index afb14ace9f..7d55d02865 100644
--- a/InvenTree/static/script/inventree/modals.js
+++ b/InvenTree/static/script/inventree/modals.js
@@ -362,7 +362,7 @@ function insertNewItemButton(modal, options) {
var html = "";
- html += "