diff --git a/InvenTree/InvenTree/views.py b/InvenTree/InvenTree/views.py index 6fc4302bfa..c160398caf 100644 --- a/InvenTree/InvenTree/views.py +++ b/InvenTree/InvenTree/views.py @@ -241,4 +241,8 @@ class SearchView(TemplateView): context = self.get_context_data() + query = request.POST.get('search', '') + + context['query'] = query + return super(TemplateView, self).render_to_response(context) diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py index d849506c06..e13d493fc3 100644 --- a/InvenTree/part/api.py +++ b/InvenTree/part/api.py @@ -121,7 +121,7 @@ class PartList(generics.ListCreateAPIView): ordering = 'name' search_fields = [ - 'name', + '$name', 'description', ] diff --git a/InvenTree/part/templates/part/stock.html b/InvenTree/part/templates/part/stock.html index 96fd03e3cd..5bece01f2e 100644 --- a/InvenTree/part/templates/part/stock.html +++ b/InvenTree/part/templates/part/stock.html @@ -78,9 +78,15 @@ searchable: false, sortable: true, formatter: function(value, row, index, field) { - return renderLink(value, row.url); + var text = renderLink(value, row.url) + text = text + "" + row.status + ""; + return text; } - } + }, + { + field: 'notes', + title: 'Notes', + }, ], url: "{% url 'api-stock-list' %}" }); diff --git a/InvenTree/stock/migrations/0007_auto_20190417_1812.py b/InvenTree/stock/migrations/0007_auto_20190417_1812.py new file mode 100644 index 0000000000..8b9ec638e3 --- /dev/null +++ b/InvenTree/stock/migrations/0007_auto_20190417_1812.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2 on 2019-04-17 08:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0006_stockitem_uuid'), + ] + + operations = [ + migrations.AlterField( + model_name='stockitem', + name='notes', + field=models.CharField(blank=True, help_text='Stock Item Notes', max_length=250), + ), + ] diff --git a/InvenTree/stock/migrations/0008_auto_20190417_1819.py b/InvenTree/stock/migrations/0008_auto_20190417_1819.py new file mode 100644 index 0000000000..46659abd66 --- /dev/null +++ b/InvenTree/stock/migrations/0008_auto_20190417_1819.py @@ -0,0 +1,20 @@ +# Generated by Django 2.2 on 2019-04-17 08:19 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('stock', '0007_auto_20190417_1812'), + ] + + operations = [ + migrations.AlterField( + model_name='stockitem', + name='stocktake_user', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='stocktake_stock', to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 7731324622..6af5b3d4b7 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -163,7 +163,8 @@ class StockItem(models.Model): # last time the stock was checked / counted stocktake_date = models.DateField(blank=True, null=True) - stocktake_user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True) + stocktake_user = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True, + related_name='stocktake_stock') review_needed = models.BooleanField(default=False) @@ -184,7 +185,7 @@ class StockItem(models.Model): choices=ITEM_STATUS_CODES.items(), validators=[MinValueValidator(0)]) - notes = models.TextField(blank=True) + notes = models.CharField(max_length=250, blank=True, help_text='Stock Item Notes') # If stock item is incoming, an (optional) ETA field # expected_arrival = models.DateField(null=True, blank=True) diff --git a/InvenTree/stock/templates/stock/item.html b/InvenTree/stock/templates/stock/item.html index 572f7b8e4b..f1f0a5db1d 100644 --- a/InvenTree/stock/templates/stock/item.html +++ b/InvenTree/stock/templates/stock/item.html @@ -20,7 +20,7 @@
Part | +{{ item.part.name }} | +|
UUID | +{{ item.uuid }} | +|
Belongs To | +{{ item.belongs_to }} | +|
Location | +{{ item.location.name }} | +|
Serial | +{{ item.serial }} | +|
Quantity | +{{ item.quantity }} | +|
Batch | +{{ item.batch }} | +|
Customer | +{{ item.customer.name }} | +|
URL | +{{ item.URL }} | +|
Supplier Part | +{{ item.supplier_part.SKU }} | +|
Last Updated | +{{ item.updated }} | +|
Last Stocktake | + {% if item.stocktake_date %} +{{ item.stocktake_date }} {{ item.stocktake_user }} | + {% else %} +No stocktake performed | + {% endif %} +
Status | +{{ item.get_status_display }} | +|
Notes | +{{ item.notes }} | +
Part | -{{ item.part.name }} | -
UUID | -{{ item.uuid }} | -
Belongs To | -{{ item.belongs_to }} | -
Location | -{{ item.location.name }} | -
Serial | -{{ item.serial }} | -
Quantity | -{{ item.quantity }} | -
Batch | -{{ item.batch }} | -
Customer | -{{ item.customer.name }} | -
URL | -{{ item.URL }} | -
Supplier Part | -{{ item.supplier_part.SKU }} | -
Updated | -{{ item.updated }} | -
Stocktake | -{{ item.stocktake_date }} {{ item.stocktake_user }} | -
Status | -{{ item.get_status_display }} | -
Notes | -{{ item.notes }} | -
- Search stuff goes here. -
+