mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
added in optional matches
This commit is contained in:
parent
74bd975a0b
commit
daf3d06cf0
@ -144,6 +144,24 @@ class MatchItemForm(forms.Form):
|
||||
initial=value,
|
||||
)
|
||||
|
||||
# Create item selection box
|
||||
elif col_guess in file_manager.OPTIONAL_MATCH_HEADERS:
|
||||
# Get item options
|
||||
item_options = [(option.id, option) for option in row['match_options_' + col_guess]]
|
||||
# Get item match
|
||||
item_match = row['match_' + col_guess]
|
||||
# Set field select box
|
||||
self.fields[field_name] = forms.ChoiceField(
|
||||
choices=[('', '-' * 10)] + item_options,
|
||||
required=False,
|
||||
widget=forms.Select(attrs={
|
||||
'class': 'select bomselect',
|
||||
})
|
||||
)
|
||||
# Update select box when match was found
|
||||
if item_match:
|
||||
self.fields[field_name].initial = item_match.id
|
||||
|
||||
# Create item selection box
|
||||
elif col_guess in file_manager.ITEM_MATCH_HEADERS:
|
||||
# Get item options
|
||||
|
Loading…
Reference in New Issue
Block a user