mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add "install_into" field for BuildItem
- Points to which output stock item it will be going into
This commit is contained in:
parent
85ac1bfb95
commit
fdcef7b699
25
InvenTree/build/migrations/0021_auto_20201020_0908.py
Normal file
25
InvenTree/build/migrations/0021_auto_20201020_0908.py
Normal file
@ -0,0 +1,25 @@
|
||||
# Generated by Django 3.0.7 on 2020-10-20 09:08
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stock', '0052_stockitem_is_building'),
|
||||
('build', '0020_auto_20201019_1325'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='builditem',
|
||||
name='install_into',
|
||||
field=models.ForeignKey(blank=True, help_text='Destination stock item', limit_choices_to={'is_building': True}, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='items_to_install', to='stock.StockItem'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='builditem',
|
||||
name='stock_item',
|
||||
field=models.ForeignKey(help_text='Source stock item', limit_choices_to={'belongs_to': None, 'build_order': None, 'sales_order': None}, on_delete=django.db.models.deletion.CASCADE, related_name='allocations', to='stock.StockItem'),
|
||||
),
|
||||
]
|
@ -568,7 +568,7 @@ class BuildItem(models.Model):
|
||||
'stock.StockItem',
|
||||
on_delete=models.CASCADE,
|
||||
related_name='allocations',
|
||||
help_text=_('Stock Item to allocate to build'),
|
||||
help_text=_('Source stock item'),
|
||||
limit_choices_to={
|
||||
'build_order': None,
|
||||
'sales_order': None,
|
||||
@ -583,3 +583,14 @@ class BuildItem(models.Model):
|
||||
validators=[MinValueValidator(0)],
|
||||
help_text=_('Stock quantity to allocate to build')
|
||||
)
|
||||
|
||||
install_into = models.ForeignKey(
|
||||
'stock.StockItem',
|
||||
on_delete=models.SET_NULL,
|
||||
blank=True, null=True,
|
||||
related_name='items_to_install',
|
||||
help_text=_('Destination stock item'),
|
||||
limit_choices_to={
|
||||
'is_building': True,
|
||||
}
|
||||
)
|
||||
|
@ -493,6 +493,12 @@ class StockList(generics.ListCreateAPIView):
|
||||
if build_order:
|
||||
queryset = queryset.filter(build_order=build_order)
|
||||
|
||||
is_building = params.get('is_building', None)
|
||||
|
||||
if is_building:
|
||||
is_building = str2bool(is_building)
|
||||
queryset = queryset.filter(is_building=is_building)
|
||||
|
||||
sales_order = params.get('sales_order', None)
|
||||
|
||||
if sales_order:
|
||||
|
Loading…
Reference in New Issue
Block a user