Hide fields rather than pop, to reduce warnings in CI logs

This commit is contained in:
Oliver Walters 2021-03-04 21:42:49 +11:00
parent 249860fa76
commit d111e7bff0

View File

@ -613,7 +613,7 @@ class PartCreate(AjaxCreateView):
# Hide the "default expiry" field if the feature is not enabled # Hide the "default expiry" field if the feature is not enabled
if not inventree_settings.stock_expiry_enabled(): if not inventree_settings.stock_expiry_enabled():
form.fields.pop('default_expiry') form.fields['default_expiry'].widget = HiddenInput()
# Hide the default_supplier field (there are no matching supplier parts yet!) # Hide the default_supplier field (there are no matching supplier parts yet!)
form.fields['default_supplier'].widget = HiddenInput() form.fields['default_supplier'].widget = HiddenInput()
@ -904,7 +904,7 @@ class PartEdit(AjaxUpdateView):
# Hide the "default expiry" field if the feature is not enabled # Hide the "default expiry" field if the feature is not enabled
if not inventree_settings.stock_expiry_enabled(): if not inventree_settings.stock_expiry_enabled():
form.fields.pop('default_expiry') form.fields['default_expiry'].widget = HiddenInput()
part = self.get_object() part = self.get_object()