Merge remote-tracking branch 'inventree/master'

This commit is contained in:
Oliver Walters 2019-09-07 21:23:50 +10:00
commit 83af318ad0
3 changed files with 21 additions and 0 deletions

View File

@ -55,6 +55,7 @@ InvenTree | Supplier List
{
field: 'description',
title: 'Description',
sortable: true,
},
{
field: 'website',
@ -69,6 +70,7 @@ InvenTree | Supplier List
{
field: 'part_count',
title: 'Parts',
sortable: true,
formatter: function(value, row, index, field) {
return renderLink(value, row.url + 'parts/');
}

View File

@ -49,6 +49,10 @@
<div class='alert alert-block alert-info'>
This stock item is serialized - it has a unique serial number and the quantity cannot be adjusted.
</div>
{% elif item.delete_on_deplete %}
<div class='alert alert-block alert-warning'>
This stock item will be automatically deleted when all stock is depleted.
</div>
{% endif %}
</div>
@ -221,6 +225,7 @@
item: {{ item.id }},
},
reload: true,
follow: true,
}
);
}

View File

@ -10,6 +10,7 @@ from django.views.generic.edit import FormMixin
from django.views.generic import DetailView, ListView
from django.forms.models import model_to_dict
from django.forms import HiddenInput
from django.urls import reverse
from django.utils.translation import ugettext as _
@ -310,6 +311,19 @@ class StockAdjust(AjaxView, FormMixin):
data['success'] = result
# Special case - Single Stock Item
# If we deplete the stock item, we MUST redirect to a new view
single_item = len(self.stock_items) == 1
if result and single_item:
# Was the entire stock taken?
item = self.stock_items[0]
if item.quantity == 0:
# Instruct the form to redirect
data['url'] = reverse('stock-index')
return self.renderJsonResponse(request, form, data=data)
def do_action(self):