mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add default values for create part form
This commit is contained in:
parent
8149759852
commit
e1b70ff68f
@ -174,7 +174,9 @@ class SetPartCategoryForm(forms.Form):
|
|||||||
|
|
||||||
|
|
||||||
class EditPartForm(HelperForm):
|
class EditPartForm(HelperForm):
|
||||||
""" Form for editing a Part object """
|
"""
|
||||||
|
Form for editing a Part object.
|
||||||
|
"""
|
||||||
|
|
||||||
field_prefix = {
|
field_prefix = {
|
||||||
'keywords': 'fa-key',
|
'keywords': 'fa-key',
|
||||||
@ -202,14 +204,14 @@ class EditPartForm(HelperForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Part
|
model = Part
|
||||||
fields = [
|
fields = [
|
||||||
'bom_copy',
|
|
||||||
'parameters_copy',
|
|
||||||
'confirm_creation',
|
|
||||||
'category',
|
'category',
|
||||||
'name',
|
'name',
|
||||||
'IPN',
|
'IPN',
|
||||||
'description',
|
'description',
|
||||||
'revision',
|
'revision',
|
||||||
|
'bom_copy',
|
||||||
|
'parameters_copy',
|
||||||
|
'confirm_creation',
|
||||||
'keywords',
|
'keywords',
|
||||||
'variant_of',
|
'variant_of',
|
||||||
'link',
|
'link',
|
||||||
@ -217,6 +219,9 @@ class EditPartForm(HelperForm):
|
|||||||
'default_supplier',
|
'default_supplier',
|
||||||
'units',
|
'units',
|
||||||
'minimum_stock',
|
'minimum_stock',
|
||||||
|
'trackable',
|
||||||
|
'purchaseable',
|
||||||
|
'salable',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -203,6 +203,7 @@
|
|||||||
<td><i>{% trans "Part cannot be sold to customers" %}</i></td>
|
<td><i>{% trans "Part cannot be sold to customers" %}</i></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr><td colspan='4'></td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{% if part.active %}
|
{% if part.active %}
|
||||||
|
@ -700,6 +700,11 @@ class PartCreate(AjaxCreateView):
|
|||||||
if label in self.request.GET:
|
if label in self.request.GET:
|
||||||
initials[label] = self.request.GET.get(label)
|
initials[label] = self.request.GET.get(label)
|
||||||
|
|
||||||
|
# Default values for part options
|
||||||
|
initials['purchaseable'] = str2bool(InvenTreeSetting.get_setting('PART_PURCHASEABLE'))
|
||||||
|
initials['salable'] = str2bool(InvenTreeSetting.get_setting('PART_SALABLE'))
|
||||||
|
initials['trackable'] = str2bool(InvenTreeSetting.get_setting('PART_TRACKABLE'))
|
||||||
|
|
||||||
return initials
|
return initials
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user