mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix form validation
This commit is contained in:
parent
42a75a8238
commit
852da6d696
@ -282,7 +282,7 @@ class InstallStockForm(HelperForm):
|
||||
|
||||
part = forms.ModelChoiceField(
|
||||
queryset=Part.objects.all(),
|
||||
widget=forms.HiddenInput
|
||||
widget=forms.HiddenInput()
|
||||
)
|
||||
|
||||
stock_item = forms.ModelChoiceField(
|
||||
@ -321,10 +321,10 @@ class InstallStockForm(HelperForm):
|
||||
|
||||
print("Data:", data)
|
||||
|
||||
stock_item = data['stock_item']
|
||||
quantity = data['quantity_to_install']
|
||||
stock_item = data.get('stock_item', None)
|
||||
quantity = data.get('quantity_to_install', None)
|
||||
|
||||
if quantity > stock_item.quantity:
|
||||
if stock_item and quantity and quantity > stock_item.quantity:
|
||||
raise ValidationError({'quantity_to_install': _('Must not exceed available quantity')})
|
||||
|
||||
return data
|
||||
|
@ -1078,8 +1078,6 @@ function loadInstalledInTable(table, options) {
|
||||
if (!match) {
|
||||
// The stock item did *not* match any items in the BOM!
|
||||
// Add a new row to the table...
|
||||
|
||||
console.log("Found an unmatched part! " + item.pk + " -> " + item.part);
|
||||
|
||||
// Contruct a new "row" to add to the table
|
||||
var new_row = {
|
||||
|
Loading…
Reference in New Issue
Block a user