From 9e4d09343c89f90303397e6ea9bc645dbee7ad06 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 20 Apr 2020 22:39:00 +1000 Subject: [PATCH] Add ability to filter parts list by "salable" status --- InvenTree/InvenTree/static/script/inventree/part.js | 4 ++++ InvenTree/part/templates/part/detail.html | 4 +--- InvenTree/templates/table_filters.html | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/InvenTree/InvenTree/static/script/inventree/part.js b/InvenTree/InvenTree/static/script/inventree/part.js index 7dc2c6a82a..b7e5fc3155 100644 --- a/InvenTree/InvenTree/static/script/inventree/part.js +++ b/InvenTree/InvenTree/static/script/inventree/part.js @@ -158,6 +158,10 @@ function loadPartTable(table, url, options={}) { display += ``; } + if (row.salable) { + display += ``; + } + /* if (row.component) { display = display + ``; diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index 2c3e5a2884..6d7400d4da 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -164,9 +164,8 @@ {% trans "Part can be purchased from external suppliers" %} {% endif %} - {% if 0 %} - {% trans "Sellable" %} + {% trans "Salable" %} {% include "slide.html" with state=part.salable field='salable' %} {% if part.salable %} {% trans "Part can be sold to customers" %} @@ -174,7 +173,6 @@ {% trans "Part cannot be sold to customers" %} {% endif %} - {% endif %} diff --git a/InvenTree/templates/table_filters.html b/InvenTree/templates/table_filters.html index f976e977a6..29de965f83 100644 --- a/InvenTree/templates/table_filters.html +++ b/InvenTree/templates/table_filters.html @@ -93,6 +93,10 @@ function getAvailableTableFilters(tableKey) { type: 'bool', title: '{% trans "Starred" %}', }, + salable: { + type: 'bool', + title: '{% trans "Salable" %}', + }, }; }