mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Remove defunct 'build_order' field from StockItem model
- This is now handled by the new-and-improved build system, no longer required
This commit is contained in:
parent
978fd7c683
commit
e4f2eecb3b
20
InvenTree/build/migrations/0023_auto_20201110_0911.py
Normal file
20
InvenTree/build/migrations/0023_auto_20201110_0911.py
Normal file
@ -0,0 +1,20 @@
|
||||
# Generated by Django 3.0.7 on 2020-11-10 09:11
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stock', '0054_remove_stockitem_build_order'),
|
||||
('build', '0022_buildorderattachment'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='builditem',
|
||||
name='stock_item',
|
||||
field=models.ForeignKey(help_text='Source stock item', limit_choices_to={'belongs_to': None, 'sales_order': None}, on_delete=django.db.models.deletion.CASCADE, related_name='allocations', to='stock.StockItem'),
|
||||
),
|
||||
]
|
@ -962,7 +962,6 @@ class BuildItem(models.Model):
|
||||
related_name='allocations',
|
||||
help_text=_('Source stock item'),
|
||||
limit_choices_to={
|
||||
'build_order': None,
|
||||
'sales_order': None,
|
||||
'belongs_to': None,
|
||||
}
|
||||
|
20
InvenTree/order/migrations/0037_auto_20201110_0911.py
Normal file
20
InvenTree/order/migrations/0037_auto_20201110_0911.py
Normal file
@ -0,0 +1,20 @@
|
||||
# Generated by Django 3.0.7 on 2020-11-10 09:11
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stock', '0054_remove_stockitem_build_order'),
|
||||
('order', '0036_auto_20200831_0912'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='salesorderallocation',
|
||||
name='item',
|
||||
field=models.ForeignKey(help_text='Select stock item to allocate', limit_choices_to={'belongs_to': None, 'part__salable': True, 'sales_order': None}, on_delete=django.db.models.deletion.CASCADE, related_name='sales_order_allocations', to='stock.StockItem'),
|
||||
),
|
||||
]
|
@ -621,7 +621,6 @@ class SalesOrderAllocation(models.Model):
|
||||
'part__salable': True,
|
||||
'belongs_to': None,
|
||||
'sales_order': None,
|
||||
'build_order': None,
|
||||
},
|
||||
help_text=_('Select stock item to allocate')
|
||||
)
|
||||
|
@ -83,8 +83,6 @@ class StockItemResource(ModelResource):
|
||||
|
||||
sales_order = Field(attribute='sales_order', widget=widgets.ForeignKeyWidget(SalesOrder))
|
||||
|
||||
build_order = Field(attribute='build_order', widget=widgets.ForeignKeyWidget(Build))
|
||||
|
||||
purchase_order = Field(attribute='purchase_order', widget=widgets.ForeignKeyWidget(PurchaseOrder))
|
||||
|
||||
# Date management
|
||||
|
@ -488,11 +488,7 @@ class StockList(generics.ListCreateAPIView):
|
||||
if build:
|
||||
queryset = queryset.filter(build=build)
|
||||
|
||||
build_order = params.get('build_order', None)
|
||||
|
||||
if build_order:
|
||||
queryset = queryset.filter(build_order=build_order)
|
||||
|
||||
# Filter by 'is building' status
|
||||
is_building = params.get('is_building', None)
|
||||
|
||||
if is_building:
|
||||
|
@ -0,0 +1,17 @@
|
||||
# Generated by Django 3.0.7 on 2020-11-10 09:11
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stock', '0053_auto_20201110_0513'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='stockitem',
|
||||
name='build_order',
|
||||
),
|
||||
]
|
@ -136,7 +136,6 @@ class StockItem(MPTTModel):
|
||||
purchase_order: Link to a PurchaseOrder (if this stock item was created from a PurchaseOrder)
|
||||
infinite: If True this StockItem can never be exhausted
|
||||
sales_order: Link to a SalesOrder object (if the StockItem has been assigned to a SalesOrder)
|
||||
build_order: Link to a BuildOrder object (if the StockItem has been assigned to a BuildOrder)
|
||||
purchase_price: The unit purchase price for this StockItem - this is the unit price at time of purchase (if this item was purchased from an external supplier)
|
||||
"""
|
||||
|
||||
@ -144,7 +143,6 @@ class StockItem(MPTTModel):
|
||||
IN_STOCK_FILTER = Q(
|
||||
quantity__gt=0,
|
||||
sales_order=None,
|
||||
build_order=None,
|
||||
belongs_to=None,
|
||||
customer=None,
|
||||
is_building=False,
|
||||
@ -430,14 +428,6 @@ class StockItem(MPTTModel):
|
||||
related_name='stock_items',
|
||||
null=True, blank=True)
|
||||
|
||||
build_order = models.ForeignKey(
|
||||
'build.Build',
|
||||
on_delete=models.SET_NULL,
|
||||
verbose_name=_("Destination Build Order"),
|
||||
related_name='stock_items',
|
||||
null=True, blank=True
|
||||
)
|
||||
|
||||
# last time the stock was checked / counted
|
||||
stocktake_date = models.DateField(blank=True, null=True)
|
||||
|
||||
@ -614,9 +604,6 @@ class StockItem(MPTTModel):
|
||||
if self.sales_order is not None:
|
||||
return False
|
||||
|
||||
if self.build_order is not None:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def installedItemCount(self):
|
||||
@ -750,10 +737,6 @@ class StockItem(MPTTModel):
|
||||
if self.sales_order is not None:
|
||||
return False
|
||||
|
||||
# Not 'in stock' if it has been allocated to a BuildOrder
|
||||
if self.build_order is not None:
|
||||
return False
|
||||
|
||||
# Not 'in stock' if it has been assigned to a customer
|
||||
if self.customer is not None:
|
||||
return False
|
||||
|
@ -73,7 +73,6 @@ class StockItemSerializer(InvenTreeModelSerializer):
|
||||
return queryset.prefetch_related(
|
||||
'belongs_to',
|
||||
'build',
|
||||
'build_order',
|
||||
'customer',
|
||||
'sales_order',
|
||||
'supplier_part',
|
||||
@ -155,7 +154,6 @@ class StockItemSerializer(InvenTreeModelSerializer):
|
||||
'batch',
|
||||
'belongs_to',
|
||||
'build',
|
||||
'build_order',
|
||||
'customer',
|
||||
'in_stock',
|
||||
'is_building',
|
||||
|
@ -221,12 +221,6 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
|
||||
<td>{% trans "Sales Order" %}</td>
|
||||
<td><a href="{% url 'so-detail' item.sales_order.id %}">{{ item.sales_order.reference }}</a> - <a href="{% url 'company-detail' item.sales_order.customer.id %}">{{ item.sales_order.customer.name }}</a></td>
|
||||
</tr>
|
||||
{% elif item.build_order %}
|
||||
<tr>
|
||||
<td><span class='fas fa-tools'></span></td>
|
||||
<td>{% trans "Build Order" %}</td>
|
||||
<td><a href="{% url 'build-detail' item.build_order.id %}">{{ item.build_order }}</a></td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td><span class='fas fa-map-marker-alt'></span></td>
|
||||
|
Loading…
Reference in New Issue
Block a user