mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Revert "Set initial value fields to disabled for some forms"
This reverts commit c1271367bd
.
This commit is contained in:
parent
c1271367bd
commit
7ebb723d15
@ -15,12 +15,6 @@ class EditBuildForm(forms.ModelForm):
|
|||||||
|
|
||||||
self.helper.form_tag = False
|
self.helper.form_tag = False
|
||||||
|
|
||||||
initial = kwargs.get('initial', {})
|
|
||||||
|
|
||||||
for field in ['part']:
|
|
||||||
if field in initial:
|
|
||||||
self.fields['field'].disabled = True
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Build
|
model = Build
|
||||||
fields = [
|
fields = [
|
||||||
|
@ -13,11 +13,6 @@ class EditPartForm(forms.ModelForm):
|
|||||||
|
|
||||||
self.helper.form_tag = False
|
self.helper.form_tag = False
|
||||||
|
|
||||||
initial = kwargs.get('initial', {})
|
|
||||||
|
|
||||||
if 'category' in initial:
|
|
||||||
self.fields['category'].disabled = True
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Part
|
model = Part
|
||||||
fields = [
|
fields = [
|
||||||
@ -45,11 +40,6 @@ class EditCategoryForm(forms.ModelForm):
|
|||||||
|
|
||||||
self.helper.form_tag = False
|
self.helper.form_tag = False
|
||||||
|
|
||||||
initial = kwargs.get('initial', {})
|
|
||||||
|
|
||||||
if 'category' in initial:
|
|
||||||
self.fields['parent'].disabled = True
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = PartCategory
|
model = PartCategory
|
||||||
fields = [
|
fields = [
|
||||||
@ -69,12 +59,6 @@ class EditBomItemForm(forms.ModelForm):
|
|||||||
|
|
||||||
self.helper.form_tag = False
|
self.helper.form_tag = False
|
||||||
|
|
||||||
initial = kwargs.get('initial', {})
|
|
||||||
|
|
||||||
for field in ['part', 'sub_part']:
|
|
||||||
if field in initial:
|
|
||||||
self.fields[field].disabled = True
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = BomItem
|
model = BomItem
|
||||||
fields = [
|
fields = [
|
||||||
@ -91,12 +75,6 @@ class EditSupplierPartForm(forms.ModelForm):
|
|||||||
|
|
||||||
self.helper.form_tag = False
|
self.helper.form_tag = False
|
||||||
|
|
||||||
initial = kwargs.get('initial', {})
|
|
||||||
|
|
||||||
for field in ['supplier', 'part']:
|
|
||||||
if field in initial:
|
|
||||||
self.fields[field].disabled = True
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SupplierPart
|
model = SupplierPart
|
||||||
fields = [
|
fields = [
|
||||||
|
@ -98,18 +98,11 @@ $(document).ready(function () {
|
|||||||
launchModalForm("#modal-form", "{% url 'part-edit' part.id %}");
|
launchModalForm("#modal-form", "{% url 'part-edit' part.id %}");
|
||||||
});
|
});
|
||||||
|
|
||||||
{% if part.category %}
|
|
||||||
var partRedirect = "{% url 'category-detail' part.category.id %}";
|
|
||||||
{% else %}
|
|
||||||
var partRedirect = "{% url 'part-index' %}";
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
$('#delete-part').click(function() {
|
$('#delete-part').click(function() {
|
||||||
launchDeleteForm("#modal-delete",
|
launchDeleteForm("#modal-delete",
|
||||||
"{% url 'part-delete' part.id %}",
|
"{% url 'part-delete' part.id %}",
|
||||||
{
|
{redirect: "{% url 'part-index' %}"}
|
||||||
redirect: partRedirect
|
);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -239,8 +239,12 @@ class SupplierPartCreate(AjaxCreateView):
|
|||||||
|
|
||||||
if supplier_id:
|
if supplier_id:
|
||||||
initials['supplier'] = get_object_or_404(Company, pk=supplier_id)
|
initials['supplier'] = get_object_or_404(Company, pk=supplier_id)
|
||||||
|
# TODO
|
||||||
|
# self.fields['supplier'].disabled = True
|
||||||
if part_id:
|
if part_id:
|
||||||
initials['part'] = get_object_or_404(Part, pk=part_id)
|
initials['part'] = get_object_or_404(Part, pk=part_id)
|
||||||
|
# TODO
|
||||||
|
# self.fields['part'].disabled = True
|
||||||
|
|
||||||
return initials
|
return initials
|
||||||
|
|
||||||
|
@ -15,11 +15,6 @@ class EditStockLocationForm(forms.ModelForm):
|
|||||||
|
|
||||||
self.helper.form_tag = False
|
self.helper.form_tag = False
|
||||||
|
|
||||||
initial = kwargs.get('initial', {})
|
|
||||||
|
|
||||||
if 'location' in initial:
|
|
||||||
self.fields['parent'].disabled = True
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = StockLocation
|
model = StockLocation
|
||||||
fields = [
|
fields = [
|
||||||
@ -37,12 +32,6 @@ class EditStockItemForm(forms.ModelForm):
|
|||||||
|
|
||||||
self.helper.form_tag = False
|
self.helper.form_tag = False
|
||||||
|
|
||||||
initial = kwargs.get('initial', {})
|
|
||||||
|
|
||||||
for field in ['part', 'location']:
|
|
||||||
if field in initial:
|
|
||||||
self.fields[field].disabled = True
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = StockItem
|
model = StockItem
|
||||||
fields = [
|
fields = [
|
||||||
|
Loading…
Reference in New Issue
Block a user