Merge pull request #1222 from SchrodingersGat/bom-upload-fix

Fix IPN comparison against null value
This commit is contained in:
Oliver 2021-01-14 13:17:23 +11:00 committed by GitHub
commit a2f9d721f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 7 deletions

View File

@ -131,8 +131,7 @@ $.fn.inventreeTable = function(options) {
// Callback when a column is changed // Callback when a column is changed
options.onColumnSwitch = function(field, checked) { options.onColumnSwitch = function(field, checked) {
console.log(`${field} -> ${checked}`);
var columns = table.bootstrapTable('getVisibleColumns'); var columns = table.bootstrapTable('getVisibleColumns');
var text = visibleColumnString(columns); var text = visibleColumnString(columns);

View File

@ -214,9 +214,9 @@
<tr> <tr>
<td> <td>
{% if part.active %} {% if part.active %}
<span class='fas fa-check-square'></span> <span class='fas fa-check-circle icon-green'></span>
{% else %} {% else %}
<span class='fas fa-times-square'></span> <span class='fas fa-times-circle icon-red'></span>
{% endif %} {% endif %}
</td> </td>
<td><b>{% trans "Active" %}</b></td> <td><b>{% trans "Active" %}</b></td>

View File

@ -1320,7 +1320,7 @@ class BomUpload(InvenTreeRoleMixin, FormView):
# Otherwise, check to see if there is a matching IPN # Otherwise, check to see if there is a matching IPN
try: try:
if row['part_ipn']: 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 # Check for single match
if len(part_matches) == 1: if len(part_matches) == 1:

View File

@ -208,6 +208,7 @@ class StockItemSerializer(InvenTreeModelSerializer):
'stale', 'stale',
'status', 'status',
'status_text', 'status_text',
'stocktake_date',
'supplier_part', 'supplier_part',
'supplier_part_detail', 'supplier_part_detail',
'tracking_items', 'tracking_items',

View File

@ -1721,7 +1721,7 @@ class StockItemCreate(AjaxCreateView):
item = form.save(commit=False) item = form.save(commit=False)
item.user = self.request.user item.user = self.request.user
item.save() item.save(user=self.request.user)
return item return item
@ -1732,7 +1732,7 @@ class StockItemCreate(AjaxCreateView):
item = form.save(commit=False) item = form.save(commit=False)
item.user = self.request.user item.user = self.request.user
item.save() item.save(user=self.request.user)
return item return item

View File

@ -590,6 +590,11 @@ function loadStockTable(table, options) {
return locationDetail(row); return locationDetail(row);
} }
}, },
{
field: 'stocktake_date',
title: '{% trans "Stocktake" %}',
sortable: true,
},
{% settings_value "STOCK_ENABLE_EXPIRY" as expiry %} {% settings_value "STOCK_ENABLE_EXPIRY" as expiry %}
{% if expiry %} {% if expiry %}
{ {