mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	Add option for creating initial stock quantity when duplicating a part
Fixes https://github.com/inventree/InvenTree/issues/2407
This commit is contained in:
		| @@ -153,12 +153,7 @@ function partFields(options={}) { | |||||||
|         delete fields['default_expiry']; |         delete fields['default_expiry']; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // Additional fields when "creating" a new part |     if (options.create || options.duplicate) { | ||||||
|     if (options.create) { |  | ||||||
|  |  | ||||||
|         // No supplier parts available yet |  | ||||||
|         delete fields['default_supplier']; |  | ||||||
|  |  | ||||||
|         if (global_settings.PART_CREATE_INITIAL) { |         if (global_settings.PART_CREATE_INITIAL) { | ||||||
|  |  | ||||||
|             fields.initial_stock = { |             fields.initial_stock = { | ||||||
| @@ -187,6 +182,13 @@ function partFields(options={}) { | |||||||
|                 group: 'create', |                 group: 'create', | ||||||
|             }; |             }; | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     // Additional fields when "creating" a new part | ||||||
|  |     if (options.create) { | ||||||
|  |  | ||||||
|  |         // No supplier parts available yet | ||||||
|  |         delete fields['default_supplier']; | ||||||
|  |  | ||||||
|         fields.copy_category_parameters = { |         fields.copy_category_parameters = { | ||||||
|             type: 'boolean', |             type: 'boolean', | ||||||
| @@ -349,6 +351,10 @@ function duplicatePart(pk, options={}) { | |||||||
|                 duplicate: pk, |                 duplicate: pk, | ||||||
|             }); |             }); | ||||||
|  |  | ||||||
|  |             if (fields.initial_stock_location) { | ||||||
|  |                 fields.initial_stock_location.value = data.default_location; | ||||||
|  |             } | ||||||
|  |  | ||||||
|             // Remove "default_supplier" field |             // Remove "default_supplier" field | ||||||
|             delete fields['default_supplier']; |             delete fields['default_supplier']; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user