From fe5bb23d1345e11c590a25368375aab4191fb4c1 Mon Sep 17 00:00:00 2001 From: Oliver Walters <oliver.henry.walters@gmail.com> Date: Thu, 13 Jun 2019 21:57:35 +1000 Subject: [PATCH] Add notes field to purchase order line item --- InvenTree/order/forms.py | 2 +- .../0010_purchaseorderlineitem_notes.py | 18 ++++++++++++++++++ InvenTree/order/models.py | 2 ++ .../templates/order/purchase_order_detail.html | 13 +++++++++---- 4 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 InvenTree/order/migrations/0010_purchaseorderlineitem_notes.py diff --git a/InvenTree/order/forms.py b/InvenTree/order/forms.py index 08e9a6f740..c7942e3549 100644 --- a/InvenTree/order/forms.py +++ b/InvenTree/order/forms.py @@ -47,5 +47,5 @@ class EditPurchaseOrderLineItemForm(HelperForm): 'part', 'quantity', 'reference', - 'received' + 'notes', ] diff --git a/InvenTree/order/migrations/0010_purchaseorderlineitem_notes.py b/InvenTree/order/migrations/0010_purchaseorderlineitem_notes.py new file mode 100644 index 0000000000..a38a564041 --- /dev/null +++ b/InvenTree/order/migrations/0010_purchaseorderlineitem_notes.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.2 on 2019-06-13 11:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('order', '0009_auto_20190606_2133'), + ] + + operations = [ + migrations.AddField( + model_name='purchaseorderlineitem', + name='notes', + field=models.CharField(blank=True, help_text='Line item notes', max_length=500), + ), + ] diff --git a/InvenTree/order/models.py b/InvenTree/order/models.py index 27f57faa87..e4417f939a 100644 --- a/InvenTree/order/models.py +++ b/InvenTree/order/models.py @@ -162,6 +162,8 @@ class OrderLineItem(models.Model): quantity = models.PositiveIntegerField(validators=[MinValueValidator(0)], default=1, help_text=_('Item quantity')) reference = models.CharField(max_length=100, blank=True, help_text=_('Line item reference')) + + notes = models.CharField(max_length=500, blank=True, help_text=_('Line item notes')) class PurchaseOrderLineItem(OrderLineItem): diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html index 9f5c7a588e..16bf09f7e1 100644 --- a/InvenTree/order/templates/order/purchase_order_detail.html +++ b/InvenTree/order/templates/order/purchase_order_detail.html @@ -82,6 +82,7 @@ InvenTree | {{ order }} {% if not order.status == OrderStatus.PENDING %} <th data-field='received'>Received</th> {% endif %} + <th data-field='notes'>Note</th> <th data-field='buttons'></th> </tr> {% for line in order.lines.all %} @@ -103,13 +104,16 @@ InvenTree | {{ order }} {% if not order.status == OrderStatus.PENDING %} <td>{{ line.received }}</td> {% endif %} + <td> + {{ line.notes }} + </td> <td> <div class='btn-group'> - <button class='btn btn-default btn-edit' id='edit-line-item-{{ line.id }}' line='{{ line.id }}' title='Edit line item' onclick='editPurchaseOrderLineItem'> - <span class='glyphicon glyphicon-small glyphicon-edit'></span> + <button class='btn btn-default btn-edit' id='edit-line-item-{{ line.id }} title='Edit line item' onclick='editPurchaseOrderLineItem()'> + <span line='{{ line.id }}' class='glyphicon glyphicon-small glyphicon-edit'></span> </button> - <button class='btn btn-default btn-remove' id='remove-line-item-{{ line.id }' title='Remove line item' type='button' onclick='removePurchaseOrderLineItem'> - <span class='glyphicon glyphicon-small glyphicon-remove'></span> + <button class='btn btn-default btn-remove' id='remove-line-item-{{ line.id }' title='Remove line item' type='button' onclick='removePurchaseOrderLineItem()'> + <span line='{{ line.id }}' class='glyphicon glyphicon-small glyphicon-remove'></span> </button> </div> </td> @@ -171,4 +175,5 @@ $('#new-po-line').click(function() { $("#po-lines-table").bootstrapTable({ }); + {% endblock %} \ No newline at end of file