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):
|
||||
""" Form for editing a Part object """
|
||||
"""
|
||||
Form for editing a Part object.
|
||||
"""
|
||||
|
||||
field_prefix = {
|
||||
'keywords': 'fa-key',
|
||||
@ -202,14 +204,14 @@ class EditPartForm(HelperForm):
|
||||
class Meta:
|
||||
model = Part
|
||||
fields = [
|
||||
'bom_copy',
|
||||
'parameters_copy',
|
||||
'confirm_creation',
|
||||
'category',
|
||||
'name',
|
||||
'IPN',
|
||||
'description',
|
||||
'revision',
|
||||
'bom_copy',
|
||||
'parameters_copy',
|
||||
'confirm_creation',
|
||||
'keywords',
|
||||
'variant_of',
|
||||
'link',
|
||||
@ -217,6 +219,9 @@ class EditPartForm(HelperForm):
|
||||
'default_supplier',
|
||||
'units',
|
||||
'minimum_stock',
|
||||
'trackable',
|
||||
'purchaseable',
|
||||
'salable',
|
||||
]
|
||||
|
||||
|
||||
|
@ -203,6 +203,7 @@
|
||||
<td><i>{% trans "Part cannot be sold to customers" %}</i></td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
<tr><td colspan='4'></td></tr>
|
||||
<tr>
|
||||
<td>
|
||||
{% if part.active %}
|
||||
|
@ -700,6 +700,11 @@ class PartCreate(AjaxCreateView):
|
||||
if label in self.request.GET:
|
||||
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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user