Bug fix for a code path which resulted in a form failing validation but not showing any errors!

This one has been here for a while!
This commit is contained in:
Oliver Walters 2020-04-27 20:45:01 +10:00
parent 2b99cf353a
commit 489dfa1823

View File

@ -838,9 +838,12 @@ class StockItemCreate(AjaxCreateView):
if part_id:
try:
part = Part.objects.get(pk=part_id)
# Check that the supplied part is 'valid'
if not part.is_template and part.active and not part.virtual:
initials['part'] = part
initials['location'] = part.get_default_location()
initials['supplier_part'] = part.default_supplier
except (ValueError, Part.DoesNotExist):
pass