diff --git a/InvenTree/order/views.py b/InvenTree/order/views.py index 0585c34cd7..5d140fb77c 100644 --- a/InvenTree/order/views.py +++ b/InvenTree/order/views.py @@ -1273,7 +1273,7 @@ class POLineItemEdit(AjaxUpdateView): form = super().get_form() # Prevent user from editing order once line item is assigned - form.fields.pop('order') + form.fields['order'].widget = HiddenInput() return form diff --git a/InvenTree/stock/views.py b/InvenTree/stock/views.py index 5041fad9d4..c09c328c66 100644 --- a/InvenTree/stock/views.py +++ b/InvenTree/stock/views.py @@ -1170,8 +1170,9 @@ class StockItemEdit(AjaxUpdateView): query = query.filter(part=item.part.id) form.fields['supplier_part'].queryset = query - if not item.part.trackable or not item.serialized: - form.fields.pop('serial') + # Hide the serial number field if it is not required + if not item.part.trackable and not item.serialized: + form.fields['serial'].widget = HiddenInput() return form