2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 13:35:40 +00:00

Small fixes

- Hide some tabs that aren't functional yet
- Hide fields instead of marking them as disabled
- Default behaviour is to allow all hosts
This commit is contained in:
Oliver Walters
2019-04-29 18:35:16 +10:00
parent 99b386fb95
commit 3b838d29ec
4 changed files with 14 additions and 4 deletions

View File

@ -10,6 +10,7 @@ from django.shortcuts import get_object_or_404
from django.urls import reverse_lazy
from django.views.generic import DetailView, ListView
from django.forms.models import model_to_dict
from django.forms import HiddenInput
from company.models import Company
from .models import PartCategory, Part, BomItem
@ -98,7 +99,7 @@ class PartCreate(AjaxCreateView):
form = super(AjaxCreateView, self).get_form()
# Hide the default_supplier field (there are no matching supplier parts yet!)
del form.fields['default_supplier']
form.fields['default_supplier'] = HiddenInput()
return form
@ -457,11 +458,11 @@ class SupplierPartCreate(AjaxCreateView):
if form.initial.get('supplier', None):
# Hide the supplier field
form.fields['supplier'].widget.attrs['disabled'] = True
form.fields['supplier'].widget = HiddenInput()
if form.initial.get('part', None):
# Hide the part field
form.fields['part'].widget.attrs['disabled'] = True
form.fields['part'].widget = HiddenInput()
return form