mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	added in optional matches
This commit is contained in:
		| @@ -144,6 +144,24 @@ class MatchItemForm(forms.Form): | |||||||
|                             initial=value, |                             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 |                     # Create item selection box | ||||||
|                     elif col_guess in file_manager.ITEM_MATCH_HEADERS: |                     elif col_guess in file_manager.ITEM_MATCH_HEADERS: | ||||||
|                         # Get item options |                         # Get item options | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user