-
- {% if part.is_template and part.active %}
-
{% trans "New Variant" %}
- {% endif %}
+
diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py
index bf30798458..bf6a4688ff 100644
--- a/InvenTree/part/views.py
+++ b/InvenTree/part/views.py
@@ -436,7 +436,8 @@ class PartDuplicate(AjaxCreateView):
matches = match_part_names(name)
if len(matches) > 0:
- context['matches'] = matches
+ # Display the first five closest matches
+ context['matches'] = matches[:5]
# Enforce display of the checkbox
form.fields['confirm_creation'].widget = CheckboxInput()
@@ -2097,7 +2098,7 @@ class BomItemCreate(AjaxCreateView):
model = BomItem
form_class = part_forms.EditBomItemForm
ajax_template_name = 'modal_form.html'
- ajax_form_title = _('Create BOM item')
+ ajax_form_title = _('Create BOM Item')
role_required = 'part.add'
diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html
index d7eb987aab..e98ff37d93 100644
--- a/InvenTree/stock/templates/stock/item_base.html
+++ b/InvenTree/stock/templates/stock/item_base.html
@@ -234,7 +234,7 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
{% endif %}
{% if item.batch %}
-
+
{% trans "Batch" %}
{{ item.batch }}
@@ -248,7 +248,7 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
{% endif %}
{% if item.purchase_order %}
-
+
{% trans "Purchase Order" %}
{{ item.purchase_order }}
diff --git a/InvenTree/templates/js/bom.js b/InvenTree/templates/js/bom.js
index 59c7acbb7b..d1d7d91346 100644
--- a/InvenTree/templates/js/bom.js
+++ b/InvenTree/templates/js/bom.js
@@ -127,13 +127,31 @@ function loadBomTable(table, options) {
var url = `/part/${row.sub_part}/`;
var html = imageHoverIcon(row.sub_part_detail.thumbnail) + renderLink(row.sub_part_detail.full_name, url);
+ var sub_part = row.sub_part_detail;
+
+ if (sub_part.trackable) {
+ html += makeIconBadge('fa-directions', '{% trans "Trackable part" %}');
+ }
+
+ if (sub_part.virtual) {
+ html += makeIconBadge('fa-ghost', '{% trans "Virtual part" %}');
+ }
+
+ if (sub_part.is_template) {
+ html += makeIconBadge('fa-clone', '{% trans "Templat part" %}');
+ }
+
// Display an extra icon if this part is an assembly
- if (row.sub_part_detail.assembly) {
+ if (sub_part.assembly) {
var text = `
`;
html += renderLink(text, `/part/${row.sub_part}/bom/`);
}
+ if (!sub_part.active) {
+ html += `
{% trans "Inactive" %} `;
+ }
+
return html;
}
}
diff --git a/InvenTree/templates/js/company.js b/InvenTree/templates/js/company.js
index f904c0f506..164329aee4 100644
--- a/InvenTree/templates/js/company.js
+++ b/InvenTree/templates/js/company.js
@@ -110,7 +110,7 @@ function loadSupplierPartTable(table, url, options) {
// Query parameters
var params = options.params || {};
- // Load 'user' filters
+ // Load filters
var filters = loadTableFilters("supplier-part");
for (var key in params) {
@@ -122,6 +122,7 @@ function loadSupplierPartTable(table, url, options) {
$(table).inventreeTable({
url: url,
method: 'get',
+ original: params,
queryParams: filters,
name: 'supplierparts',
groupBy: false,
@@ -135,6 +136,7 @@ function loadSupplierPartTable(table, url, options) {
sortable: true,
field: 'part_detail.full_name',
title: '{% trans "Part" %}',
+ switchable: false,
formatter: function(value, row, index, field) {
var url = `/part/${row.part}/`;
diff --git a/InvenTree/templates/js/part.js b/InvenTree/templates/js/part.js
index e5fafef070..f95f353582 100644
--- a/InvenTree/templates/js/part.js
+++ b/InvenTree/templates/js/part.js
@@ -61,13 +61,22 @@ function toggleStar(options) {
}
-function loadPartVariantTable(table, partId, options) {
+function loadPartVariantTable(table, partId, options={}) {
/* Load part variant table
*/
- var params = {
- ancestor: partId,
- };
+ var params = options.params || {};
+
+ params.ancestor = partId;
+
+ // Load filters
+ var filters = loadTableFilters("variants");
+
+ for (var key in params) {
+ filters[key] = params[key];
+ }
+
+ setupFilterList("variants", $(table));
var cols = [
{
@@ -104,16 +113,36 @@ function loadPartVariantTable(table, partId, options) {
html += imageHoverIcon(row.thumbnail);
html += renderLink(name, `/part/${row.pk}/`);
+ if (row.trackable) {
+ html += makeIconBadge('fa-directions', '{% trans "Trackable part" %}');
+ }
+
+ if (row.virtual) {
+ html += makeIconBadge('fa-ghost', '{% trans "Virtual part" %}');
+ }
+
+ if (row.is_template) {
+ html += makeIconBadge('fa-clone', '{% trans "Template part" %}');
+ }
+
+ if (row.assembly) {
+ html += makeIconBadge('fa-tools', '{% trans "Assembled part" %}');
+ }
+
+ if (!row.active) {
+ html += `
{% trans "Inactive" %} `;
+ }
+
return html;
},
},
{
field: 'IPN',
- title: '{% trans 'IPN' %}',
+ title: '{% trans "IPN" %}',
},
{
field: 'revision',
- title: '{% trans 'Revision' %}',
+ title: '{% trans "Revision" %}',
},
{
field: 'description',
@@ -133,7 +162,7 @@ function loadPartVariantTable(table, partId, options) {
name: 'partvariants',
showColumns: true,
original: params,
- queryParams: params,
+ queryParams: filters,
formatNoMatches: function() { return "{% trans "No variants found" %}"; },
columns: cols,
treeEnable: true,
@@ -272,7 +301,7 @@ function loadPartTable(table, url, options={}) {
if (options.checkbox) {
columns.push({
checkbox: true,
- title: '{% trans 'Select' %}',
+ title: '{% trans "Select" %}',
searchable: false,
switchable: false,
});
@@ -286,8 +315,9 @@ function loadPartTable(table, url, options={}) {
columns.push({
field: 'name',
- title: '{% trans 'Part' %}',
+ title: '{% trans "Part" %}',
sortable: true,
+ switchable: false,
formatter: function(value, row, index, field) {
var name = '';
@@ -310,20 +340,29 @@ function loadPartTable(table, url, options={}) {
var display = imageHoverIcon(row.thumbnail) + renderLink(name, '/part/' + row.pk + '/');
+ if (row.trackable) {
+ display += makeIconBadge('fa-directions', '{% trans "Trackable part" %}');
+ }
+
+ if (row.virtual) {
+ display += makeIconBadge('fa-ghost', '{% trans "Virtual part" %}');
+ }
+
+
if (row.is_template) {
- display += `
`;
+ display += makeIconBadge('fa-clone', '{% trans "Template part" %}');
}
if (row.assembly) {
- display += `
`;
+ display += makeIconBadge('fa-tools', '{% trans "Assembled part" %}');
}
if (row.starred) {
- display += `
`;
+ display += makeIconBadge('fa-star', '{% trans "Starred part" %}');
}
if (row.salable) {
- display += `
`;
+ display += makeIconBadge('fa-dollar-sign', title='{% trans "Salable part" %}');
}
/*
@@ -342,7 +381,7 @@ function loadPartTable(table, url, options={}) {
columns.push({
sortable: true,
field: 'description',
- title: '{% trans 'Description' %}',
+ title: '{% trans "Description" %}',
formatter: function(value, row, index, field) {
if (row.is_template) {
@@ -356,7 +395,7 @@ function loadPartTable(table, url, options={}) {
columns.push({
sortable: true,
field: 'category_detail',
- title: '{% trans 'Category' %}',
+ title: '{% trans "Category" %}',
formatter: function(value, row, index, field) {
if (row.category) {
return renderLink(value.pathstring, "/part/category/" + row.category + "/");
diff --git a/InvenTree/templates/js/table_filters.js b/InvenTree/templates/js/table_filters.js
index c05f01d37f..639e31a542 100644
--- a/InvenTree/templates/js/table_filters.js
+++ b/InvenTree/templates/js/table_filters.js
@@ -11,6 +11,28 @@ function getAvailableTableFilters(tableKey) {
tableKey = tableKey.toLowerCase();
+ // Filters for "variant" table
+ if (tableKey == "variants") {
+ return {
+ active: {
+ type: 'bool',
+ title: '{% trans "Active" %}',
+ },
+ template: {
+ type: 'bool',
+ title: '{% trans "Template" %}',
+ },
+ virtual: {
+ type: 'bool',
+ title: '{% trans "Virtual" %}',
+ },
+ trackable: {
+ type: 'bool',
+ title: '{% trans "Trackable" %}',
+ },
+ };
+ }
+
// Filters for Bill of Materials table
if (tableKey == "bom") {
return {
@@ -189,6 +211,15 @@ function getAvailableTableFilters(tableKey) {
};
}
+ if (tableKey == 'supplier-part') {
+ return {
+ active: {
+ type: 'bool',
+ title: '{% trans "Active parts" %}',
+ }
+ };
+ }
+
// Filters for the "Parts" table
if (tableKey == "parts") {
return {