mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
Fix for bug a)
- Would not create new StockItem for trackable part if Serial Numbers not provided
This commit is contained in:
parent
0939ffeb76
commit
2949289fab
@ -44,7 +44,6 @@ class CreateStockItemForm(HelperForm):
|
|||||||
'serial_numbers',
|
'serial_numbers',
|
||||||
'delete_on_deplete',
|
'delete_on_deplete',
|
||||||
'status',
|
'status',
|
||||||
'notes',
|
|
||||||
'URL',
|
'URL',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -912,6 +912,18 @@ class StockItemCreate(AjaxCreateView):
|
|||||||
valid = False
|
valid = False
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
# We have a serialized part, but no serial numbers specified...
|
||||||
|
form.clean()
|
||||||
|
form._post_clean()
|
||||||
|
|
||||||
|
item = form.save(commit=False)
|
||||||
|
item.save(user=request.user)
|
||||||
|
|
||||||
|
data['pk'] = item.pk
|
||||||
|
data['url'] = item.get_absolute_url()
|
||||||
|
data['success'] = _("Created new stock item")
|
||||||
|
|
||||||
|
else: # Referenced Part object is not marked as "trackable"
|
||||||
# For non-serialized items, simply save the form.
|
# For non-serialized items, simply save the form.
|
||||||
# We need to call _post_clean() here because it is prevented in the form implementation
|
# We need to call _post_clean() here because it is prevented in the form implementation
|
||||||
form.clean()
|
form.clean()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user