mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Added 'status' and 'delivery_date' fields to SupplierOrder
This commit is contained in:
parent
7045443d7b
commit
f4aa09a354
@ -17,7 +17,7 @@ class SupplierPartAdmin(ImportExportModelAdmin):
|
||||
|
||||
|
||||
class SupplierOrderAdmin(admin.ModelAdmin):
|
||||
list_display = ('internal_ref', 'supplier', 'issued_date')
|
||||
list_display = ('internal_ref', 'supplier', 'issued_date', 'delivery_date', 'status')
|
||||
|
||||
|
||||
admin.site.register(Supplier, SupplierAdmin)
|
||||
|
25
InvenTree/supplier/migrations/0012_auto_20180417_1447.py
Normal file
25
InvenTree/supplier/migrations/0012_auto_20180417_1447.py
Normal file
@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.12 on 2018-04-17 14:47
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('supplier', '0011_auto_20180417_1436'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='supplierorder',
|
||||
name='delivery_date',
|
||||
field=models.DateField(blank=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='supplierorder',
|
||||
name='status',
|
||||
field=models.PositiveIntegerField(choices=[(40, 'Cancelled'), (10, 'Pending'), (20, 'Placed'), (50, 'Lost'), (30, 'Received')], default=10),
|
||||
),
|
||||
]
|
@ -1,5 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from django.db import models
|
||||
from django.core.validators import MinValueValidator
|
||||
|
||||
@ -126,7 +129,27 @@ class SupplierOrder(models.Model):
|
||||
notes = models.TextField(blank=True, help_text="Order notes")
|
||||
|
||||
def __str__(self):
|
||||
return "PO {ref}".format(ref=self.internal_ref)
|
||||
return "PO {ref} ({status})".format(ref=self.internal_ref,
|
||||
status=self.get_status_display)
|
||||
|
||||
PENDING = 10 # Order is pending (not yet placed)
|
||||
PLACED = 20 # Order has been placed
|
||||
RECEIVED = 30 # Order has been received
|
||||
CANCELLED = 40 # Order was cancelled
|
||||
LOST = 50 # Order was lost
|
||||
|
||||
ORDER_STATUS_CODES = {PENDING: _("Pending"),
|
||||
PLACED: _("Placed"),
|
||||
CANCELLED: _("Cancelled"),
|
||||
RECEIVED: _("Received"),
|
||||
LOST: _("Lost")
|
||||
}
|
||||
|
||||
status = models.PositiveIntegerField(default=PENDING,
|
||||
choices=ORDER_STATUS_CODES.items())
|
||||
|
||||
delivery_date = models.DateField(blank=True, null=True)
|
||||
|
||||
|
||||
|
||||
class SupplierOrderLineItem(models.Model):
|
||||
|
@ -10,13 +10,15 @@
|
||||
<tr>
|
||||
<th>Reference</th>
|
||||
<th>Issued</th>
|
||||
<th>Delivery</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
{% for order in supplier.orders.all %}
|
||||
<tr>
|
||||
<td><a href="{% url 'supplier-order-detail' order.id %}">{{ order.internal_ref }}</a></td>
|
||||
<td>{% if order.issued_date %}{{ order.issued_date }}{% endif %}</td>
|
||||
<td>Status</td>
|
||||
<td>{% if order.delivery_date %}{{ order.delivery_date }}{% endif %}</td>
|
||||
<td>{{ order.get_status_display }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
Loading…
Reference in New Issue
Block a user