2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-14 11:05:41 +00:00

Implement POST for receiving items

- Create new StockItem in the correct location
This commit is contained in:
Oliver Walters
2019-06-15 19:39:57 +10:00
parent c7ca9a3d8f
commit 1290e7f289
8 changed files with 234 additions and 10 deletions

View File

@ -0,0 +1,20 @@
# Generated by Django 2.2.2 on 2019-06-15 09:06
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('order', '0010_purchaseorderlineitem_notes'),
('stock', '0005_auto_20190602_1944'),
]
operations = [
migrations.AddField(
model_name='stockitem',
name='purchase_order',
field=models.ForeignKey(blank=True, help_text='Purchase order for this stock item', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='stock_items', to='order.PurchaseOrder'),
),
]

View File

@ -96,6 +96,7 @@ class StockItem(models.Model):
delete_on_deplete: If True, StockItem will be deleted when the stock level gets to zero
status: Status of this StockItem (ref: InvenTree.status_codes.StockStatus)
notes: Extra notes field
purchase_order: Link to a PurchaseOrder (if this stock item was created from a PurchaseOrder)
infinite: If True this StockItem can never be exhausted
"""
@ -249,6 +250,14 @@ class StockItem(models.Model):
updated = models.DateField(auto_now=True, null=True)
purchase_order = models.ForeignKey(
'order.PurchaseOrder',
on_delete=models.SET_NULL,
related_name='stock_items',
blank=True, null=True,
help_text='Purchase order for this stock item'
)
# last time the stock was checked / counted
stocktake_date = models.DateField(blank=True, null=True)

View File

@ -71,6 +71,12 @@
<td>{{ item.batch }}</td>
</tr>
{% endif %}
{% if item.purchase_order %}
<tr>
<td>Purchase Order</td>
<td><a href="{% url 'purchase-order-detail' item.purchase_order.id %}">{{ item.purchase_order }}</a></td>
</tr>
{% endif %}
{% if item.customer %}
<tr>
<td>Customer</td>