mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 13:15:43 +00:00 
			
		
		
		
	Bugfix: CreateStockItem form
- hide the field rather than popping it
This commit is contained in:
		| @@ -1243,12 +1243,12 @@ class StockItemCreate(AjaxCreateView): | |||||||
|             # Hide the 'part' field (as a valid part is selected) |             # Hide the 'part' field (as a valid part is selected) | ||||||
|             # form.fields['part'].widget = HiddenInput() |             # form.fields['part'].widget = HiddenInput() | ||||||
|  |  | ||||||
|             # trackable parts get special consideration |             # Trackable parts get special consideration: | ||||||
|             if part.trackable: |             if part.trackable: | ||||||
|                 form.fields['delete_on_deplete'].widget = HiddenInput() |                 form.fields['delete_on_deplete'].widget = HiddenInput() | ||||||
|                 form.fields['delete_on_deplete'].initial = False |                 form.fields['delete_on_deplete'].initial = False | ||||||
|             else: |             else: | ||||||
|                 form.fields.pop('serial_numbers') |                 form.fields['serial_numbers'].widget = HiddenInput() | ||||||
|  |  | ||||||
|             # If the part is NOT purchaseable, hide the supplier_part field |             # If the part is NOT purchaseable, hide the supplier_part field | ||||||
|             if not part.purchaseable: |             if not part.purchaseable: | ||||||
| @@ -1306,8 +1306,6 @@ class StockItemCreate(AjaxCreateView): | |||||||
|         supplier_part = None |         supplier_part = None | ||||||
|  |  | ||||||
|         if part is not None: |         if part is not None: | ||||||
|             # Check that the supplied part is 'valid' |  | ||||||
|             if not part.is_template and part.active and not part.virtual: |  | ||||||
|             initials['part'] = part |             initials['part'] = part | ||||||
|             initials['location'] = part.get_default_location() |             initials['location'] = part.get_default_location() | ||||||
|             initials['supplier_part'] = part.default_supplier |             initials['supplier_part'] = part.default_supplier | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user