From 890ce9ef956fa132eceab737fbf24d66f94e2133 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 14 Jan 2021 10:58:29 +1100 Subject: [PATCH 1/4] Fix IPN comparison against null value --- InvenTree/part/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index 0e16bfb498..26cf93e56d 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -1320,7 +1320,7 @@ class BomUpload(InvenTreeRoleMixin, FormView): # Otherwise, check to see if there is a matching IPN try: if row['part_ipn']: - part_matches = [part for part in self.allowed_parts if row['part_ipn'].lower() == part.IPN.lower()] + part_matches = [part for part in self.allowed_parts if part.IPN and row['part_ipn'].lower() == str(part.IPN.lower())] # Check for single match if len(part_matches) == 1: From 1316e6bf5b8134d4586f9ed8643bfe2e28c99854 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 14 Jan 2021 11:24:52 +1100 Subject: [PATCH 2/4] Properly save user data when creating a new StockItem --- InvenTree/stock/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/InvenTree/stock/views.py b/InvenTree/stock/views.py index 830f2c66f7..5d505b5280 100644 --- a/InvenTree/stock/views.py +++ b/InvenTree/stock/views.py @@ -1721,7 +1721,7 @@ class StockItemCreate(AjaxCreateView): item = form.save(commit=False) item.user = self.request.user - item.save() + item.save(user=self.request.user) return item @@ -1732,7 +1732,7 @@ class StockItemCreate(AjaxCreateView): item = form.save(commit=False) item.user = self.request.user - item.save() + item.save(user=self.request.user) return item From df327d4e6418810f898a3556ba55d59321c3f63c Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 14 Jan 2021 11:29:35 +1100 Subject: [PATCH 3/4] Add stocktake_date field to stock API, and to stock table --- InvenTree/InvenTree/static/script/inventree/tables.js | 3 +-- InvenTree/stock/serializers.py | 1 + InvenTree/templates/js/stock.js | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/InvenTree/InvenTree/static/script/inventree/tables.js b/InvenTree/InvenTree/static/script/inventree/tables.js index 1a50780393..4d868f94b4 100644 --- a/InvenTree/InvenTree/static/script/inventree/tables.js +++ b/InvenTree/InvenTree/static/script/inventree/tables.js @@ -131,8 +131,7 @@ $.fn.inventreeTable = function(options) { // Callback when a column is changed options.onColumnSwitch = function(field, checked) { - console.log(`${field} -> ${checked}`); - + var columns = table.bootstrapTable('getVisibleColumns'); var text = visibleColumnString(columns); diff --git a/InvenTree/stock/serializers.py b/InvenTree/stock/serializers.py index 70ad1abc18..6048d5e248 100644 --- a/InvenTree/stock/serializers.py +++ b/InvenTree/stock/serializers.py @@ -208,6 +208,7 @@ class StockItemSerializer(InvenTreeModelSerializer): 'stale', 'status', 'status_text', + 'stocktake_date', 'supplier_part', 'supplier_part_detail', 'tracking_items', diff --git a/InvenTree/templates/js/stock.js b/InvenTree/templates/js/stock.js index e3f124d252..9ce395db57 100644 --- a/InvenTree/templates/js/stock.js +++ b/InvenTree/templates/js/stock.js @@ -590,6 +590,11 @@ function loadStockTable(table, options) { return locationDetail(row); } }, + { + field: 'stocktake_date', + title: '{% trans "Stocktake" %}', + sortable: true, + }, {% settings_value "STOCK_ENABLE_EXPIRY" as expiry %} {% if expiry %} { From 1cb951bd0b682030255292eba236a042c42d99dc Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 14 Jan 2021 12:08:54 +1100 Subject: [PATCH 4/4] Fix for font-awesome icon --- InvenTree/part/templates/part/detail.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index f723193abb..59c33ea7b6 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -214,9 +214,9 @@ {% if part.active %} - + {% else %} - + {% endif %} {% trans "Active" %}