mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Merge pull request #235 from SchrodingersGat/filter_active_parts
Filter active parts
This commit is contained in:
		
							
								
								
									
										19
									
								
								InvenTree/build/migrations/0010_auto_20190505_2233.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								InvenTree/build/migrations/0010_auto_20190505_2233.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | |||||||
|  | # Generated by Django 2.2 on 2019-05-05 12:33 | ||||||
|  |  | ||||||
|  | from django.db import migrations, models | ||||||
|  | import django.db.models.deletion | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Migration(migrations.Migration): | ||||||
|  |  | ||||||
|  |     dependencies = [ | ||||||
|  |         ('build', '0009_build_completed_by'), | ||||||
|  |     ] | ||||||
|  |  | ||||||
|  |     operations = [ | ||||||
|  |         migrations.AlterField( | ||||||
|  |             model_name='build', | ||||||
|  |             name='part', | ||||||
|  |             field=models.ForeignKey(limit_choices_to={'active': True, 'buildable': True}, on_delete=django.db.models.deletion.CASCADE, related_name='builds', to='part.Part'), | ||||||
|  |         ), | ||||||
|  |     ] | ||||||
| @@ -84,7 +84,10 @@ class Build(models.Model): | |||||||
|  |  | ||||||
|     part = models.ForeignKey('part.Part', on_delete=models.CASCADE, |     part = models.ForeignKey('part.Part', on_delete=models.CASCADE, | ||||||
|                              related_name='builds', |                              related_name='builds', | ||||||
|                              limit_choices_to={'buildable': True}, |                              limit_choices_to={ | ||||||
|  |                                  'buildable': True, | ||||||
|  |                                  'active': True | ||||||
|  |                              }, | ||||||
|                              ) |                              ) | ||||||
|      |      | ||||||
|     title = models.CharField( |     title = models.CharField( | ||||||
|   | |||||||
							
								
								
									
										24
									
								
								InvenTree/part/migrations/0018_auto_20190505_2231.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								InvenTree/part/migrations/0018_auto_20190505_2231.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | |||||||
|  | # Generated by Django 2.2 on 2019-05-05 12:31 | ||||||
|  |  | ||||||
|  | from django.db import migrations, models | ||||||
|  | import django.db.models.deletion | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Migration(migrations.Migration): | ||||||
|  |  | ||||||
|  |     dependencies = [ | ||||||
|  |         ('part', '0017_auto_20190505_0848'), | ||||||
|  |     ] | ||||||
|  |  | ||||||
|  |     operations = [ | ||||||
|  |         migrations.AlterField( | ||||||
|  |             model_name='bomitem', | ||||||
|  |             name='part', | ||||||
|  |             field=models.ForeignKey(limit_choices_to={'active': True, 'buildable': True}, on_delete=django.db.models.deletion.CASCADE, related_name='bom_items', to='part.Part'), | ||||||
|  |         ), | ||||||
|  |         migrations.AlterField( | ||||||
|  |             model_name='bomitem', | ||||||
|  |             name='sub_part', | ||||||
|  |             field=models.ForeignKey(limit_choices_to={'active': True, 'consumable': True}, on_delete=django.db.models.deletion.CASCADE, related_name='used_in', to='part.Part'), | ||||||
|  |         ), | ||||||
|  |     ] | ||||||
| @@ -464,12 +464,18 @@ class BomItem(models.Model): | |||||||
|     # A link to the parent part |     # A link to the parent part | ||||||
|     # Each part will get a reverse lookup field 'bom_items' |     # Each part will get a reverse lookup field 'bom_items' | ||||||
|     part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='bom_items', |     part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='bom_items', | ||||||
|                              limit_choices_to={'buildable': True}) |                              limit_choices_to={ | ||||||
|  |                                  'buildable': True, | ||||||
|  |                                  'active': True, | ||||||
|  |                              }) | ||||||
|  |  | ||||||
|     # A link to the child item (sub-part) |     # A link to the child item (sub-part) | ||||||
|     # Each part will get a reverse lookup field 'used_in' |     # Each part will get a reverse lookup field 'used_in' | ||||||
|     sub_part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='used_in', |     sub_part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='used_in', | ||||||
|                                  limit_choices_to={'consumable': True}) |                                  limit_choices_to={ | ||||||
|  |                                      'consumable': True, | ||||||
|  |                                      'active': True | ||||||
|  |                                  }) | ||||||
|  |  | ||||||
|     # Quantity required |     # Quantity required | ||||||
|     quantity = models.PositiveIntegerField(default=1, validators=[MinValueValidator(0)]) |     quantity = models.PositiveIntegerField(default=1, validators=[MinValueValidator(0)]) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user