diff --git a/InvenTree/InvenTree/middleware.py b/InvenTree/InvenTree/middleware.py
index fc75be2fb4..13b1a135fe 100644
--- a/InvenTree/InvenTree/middleware.py
+++ b/InvenTree/InvenTree/middleware.py
@@ -14,7 +14,7 @@ class AuthRequiredMiddleware(object):
response = self.get_response(request)
- if not request.user.is_authenticated():
+ if not request.user.is_authenticated:
print(request.path_info)
if not request.path_info == reverse_lazy('login'):
diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py
index edfc1a6750..4830ecd518 100644
--- a/InvenTree/InvenTree/urls.py
+++ b/InvenTree/InvenTree/urls.py
@@ -48,8 +48,8 @@ urlpatterns = [
url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')),
- url(r'^login/', auth_views.login, name='login'),
- url(r'^logout/', auth_views.logout, {'template_name': 'registration/logout.html'}, name='logout'),
+ url(r'^login/', auth_views.LoginView.as_view(), name='login'),
+ url(r'^logout/', auth_views.LogoutView.as_view(template_name='registration/logout.html'), name='logout'),
url(r'^admin/', admin.site.urls, name='inventree-admin'),
url(r'^index/', IndexView.as_view(), name='index'),
diff --git a/InvenTree/build/migrations/0002_auto_20190412_2030.py b/InvenTree/build/migrations/0002_auto_20190412_2030.py
new file mode 100644
index 0000000000..eca2bf5adb
--- /dev/null
+++ b/InvenTree/build/migrations/0002_auto_20190412_2030.py
@@ -0,0 +1,25 @@
+# Generated by Django 2.2 on 2019-04-12 10:30
+
+import django.core.validators
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('build', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='build',
+ name='part',
+ field=models.ForeignKey(limit_choices_to={'buildable': True}, on_delete=django.db.models.deletion.CASCADE, related_name='builds', to='part.Part'),
+ ),
+ migrations.AlterField(
+ model_name='build',
+ name='status',
+ field=models.PositiveIntegerField(choices=[(10, 'Pending'), (20, 'Holding'), (30, 'Cancelled'), (40, 'Complete')], default=10, validators=[django.core.validators.MinValueValidator(0)]),
+ ),
+ ]
diff --git a/InvenTree/company/templates/company/detail_part.html b/InvenTree/company/templates/company/detail_part.html
index 1de24d9d7e..901ba94293 100644
--- a/InvenTree/company/templates/company/detail_part.html
+++ b/InvenTree/company/templates/company/detail_part.html
@@ -58,7 +58,7 @@
field: 'part',
title: 'Part',
formatter: function(value, row, index, field) {
- return renderLink(value.name, value.url);
+ return renderLink(value.name, value.url + 'suppliers/');
}
},
{
@@ -73,6 +73,11 @@
sortable: true,
field: 'manufacturer',
title: 'Manufacturer',
+ },
+ {
+ sortable: true,
+ field: 'MPN',
+ title: 'MPN',
}
],
url: "{% url 'api-part-supplier-list' %}"
diff --git a/InvenTree/company/templates/company/index.html b/InvenTree/company/templates/company/index.html
index e8698dc5e1..90490bf7ad 100644
--- a/InvenTree/company/templates/company/index.html
+++ b/InvenTree/company/templates/company/index.html
@@ -20,7 +20,7 @@
{% block js_ready %}
{{ block.super }}
$('#new-company').click(function () {
- launchModalForm('#modal-form',
+ launchModalForm(
"{% url 'company-create' %}",
{
follow: true
diff --git a/InvenTree/company/templates/company/partdetail.html b/InvenTree/company/templates/company/partdetail.html
index b17fafebd6..0710e10053 100644
--- a/InvenTree/company/templates/company/partdetail.html
+++ b/InvenTree/company/templates/company/partdetail.html
@@ -35,7 +35,7 @@
{% if part.URL %}
-
| {{ part.URL }} |
+ URL | {{ part.URL }} |
{% endif %}
{% if part.description %}
Description | {{ part.description }} |
diff --git a/InvenTree/part/migrations/0003_auto_20190412_2030.py b/InvenTree/part/migrations/0003_auto_20190412_2030.py
new file mode 100644
index 0000000000..3439c09483
--- /dev/null
+++ b/InvenTree/part/migrations/0003_auto_20190412_2030.py
@@ -0,0 +1,19 @@
+# Generated by Django 2.2 on 2019-04-12 10:30
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('part', '0002_part_default_location'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='bomitem',
+ name='part',
+ field=models.ForeignKey(limit_choices_to={'buildable': True}, on_delete=django.db.models.deletion.CASCADE, related_name='bom_items', to='part.Part'),
+ ),
+ ]
diff --git a/InvenTree/part/serializers.py b/InvenTree/part/serializers.py
index 061bf06145..5746c00fdd 100644
--- a/InvenTree/part/serializers.py
+++ b/InvenTree/part/serializers.py
@@ -32,6 +32,7 @@ class PartBriefSerializer(serializers.ModelSerializer):
'url',
'name',
'description',
+ 'available_stock',
]
diff --git a/InvenTree/part/templates/part/bom.html b/InvenTree/part/templates/part/bom.html
index 723e0cad00..7b9e829686 100644
--- a/InvenTree/part/templates/part/bom.html
+++ b/InvenTree/part/templates/part/bom.html
@@ -85,10 +85,29 @@
},
{
field: 'quantity',
- title: 'Quantity',
+ title: 'Required',
searchable: false,
sortable: true
},
+ {
+ field: 'sub_part.available_stock',
+ title: 'Available',
+ searchable: false,
+ sortable: true,
+ formatter: function(value, row, index, field) {
+ var text = "";
+ if (row.quantity < row.sub_part.available_stock)
+ {
+ text = "" + value + "";
+ }
+ else
+ {
+ text = "" + value + "";
+ }
+
+ return renderLink(text, row.sub_part.url + "stock/");
+ }
+ },
{
formatter: function(value, row, index, field) {
return editButton(row.url + 'edit') + ' ' + deleteButton(row.url + 'delete');
diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html
index 84c86390c7..ec75d2c874 100644
--- a/InvenTree/part/templates/part/category.html
+++ b/InvenTree/part/templates/part/category.html
@@ -173,7 +173,7 @@
return renderLink(value, row.url + 'stock/');
}
else {
- return '';
+ return "No stock";
}
}
}
diff --git a/InvenTree/part/templates/part/supplier.html b/InvenTree/part/templates/part/supplier.html
index a1201cc1e8..13c745e33a 100644
--- a/InvenTree/part/templates/part/supplier.html
+++ b/InvenTree/part/templates/part/supplier.html
@@ -69,6 +69,11 @@
sortable: true,
field: 'manufacturer',
title: 'Manufacturer',
+ },
+ {
+ sortable: true,
+ field: 'MPN',
+ title: 'MPN',
}
],
url: "{% url 'api-part-supplier-list' %}"
diff --git a/InvenTree/stock/migrations/0004_auto_20190412_2030.py b/InvenTree/stock/migrations/0004_auto_20190412_2030.py
new file mode 100644
index 0000000000..d55dbc6fff
--- /dev/null
+++ b/InvenTree/stock/migrations/0004_auto_20190412_2030.py
@@ -0,0 +1,19 @@
+# Generated by Django 2.2 on 2019-04-12 10:30
+
+import django.core.validators
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('stock', '0003_auto_20180510_1042'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='stockitem',
+ name='status',
+ field=models.PositiveIntegerField(choices=[(10, 'OK'), (50, 'Attention needed'), (55, 'Damaged'), (60, 'Destroyed')], default=10, validators=[django.core.validators.MinValueValidator(0)]),
+ ),
+ ]
diff --git a/requirements/base.txt b/requirements/base.txt
index e1cdb825c4..5c0ec6f74f 100644
--- a/requirements/base.txt
+++ b/requirements/base.txt
@@ -1,4 +1,4 @@
-Django>=1.11
+Django==2.2
pillow>=5.0.0
djangorestframework>=3.6.2
django_filter>=1.0.2