Merge pull request #667 from SchrodingersGat/hide-template-parts

Limit choices for Part selection
This commit is contained in:
Oliver 2020-03-18 21:32:29 +11:00 committed by GitHub
commit febd1ad4a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 2.2.9 on 2020-03-18 10:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('build', '0009_auto_20200210_1032'),
]
operations = [
migrations.AlterField(
model_name='build',
name='part',
field=models.ForeignKey(help_text='Select part to build', limit_choices_to={'active': True, 'assembly': True, 'is_template': False, 'virtual': False}, on_delete=django.db.models.deletion.CASCADE, related_name='builds', to='part.Part'),
),
]

View File

@ -58,7 +58,8 @@ class Build(models.Model):
limit_choices_to={
'is_template': False,
'assembly': True,
'active': True
'active': True,
'virtual': False,
},
help_text=_('Select part to build'),
)

View File

@ -0,0 +1,24 @@
# Generated by Django 2.2.9 on 2020-03-18 10:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('part', '0029_auto_20200223_0901'),
]
operations = [
migrations.AlterField(
model_name='bomitem',
name='part',
field=models.ForeignKey(help_text='Select parent part', limit_choices_to={'assembly': True, 'is_template': False}, 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(help_text='Select part to be used in BOM', limit_choices_to={'component': True, 'is_template': False}, on_delete=django.db.models.deletion.CASCADE, related_name='used_in', to='part.Part'),
),
]

View File

@ -1067,6 +1067,7 @@ class BomItem(models.Model):
help_text=_('Select parent part'),
limit_choices_to={
'assembly': True,
'is_template': False,
})
# A link to the child item (sub-part)
@ -1075,6 +1076,7 @@ class BomItem(models.Model):
help_text=_('Select part to be used in BOM'),
limit_choices_to={
'component': True,
'is_template': False,
})
# Quantity required

View File

@ -0,0 +1,19 @@
# Generated by Django 2.2.9 on 2020-03-18 10:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('stock', '0022_auto_20200217_1109'),
]
operations = [
migrations.AlterField(
model_name='stockitem',
name='part',
field=models.ForeignKey(help_text='Base part', limit_choices_to={'active': True, 'is_template': False, 'virtual': False}, on_delete=django.db.models.deletion.CASCADE, related_name='stock_items', to='part.Part'),
),
]

View File

@ -307,6 +307,7 @@ class StockItem(MPTTModel):
limit_choices_to={
'is_template': False,
'active': True,
'virtual': False
})
supplier_part = models.ForeignKey('company.SupplierPart', blank=True, null=True, on_delete=models.SET_NULL,