Convert some more fields to decimal

- purchase order line item quantity
- purchase order line item received
This commit is contained in:
Oliver Walters 2019-11-19 10:30:04 +11:00
parent a1f33c4084
commit 381becef79
9 changed files with 288 additions and 113 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 2.2.5 on 2019-11-18 23:23
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('company', '0008_auto_20190913_1407'),
]
operations = [
migrations.AlterField(
model_name='supplierpricebreak',
name='quantity',
field=models.DecimalField(decimal_places=5, default=1, max_digits=15, validators=[django.core.validators.MinValueValidator(1)]),
),
]

View File

@ -379,7 +379,7 @@ class SupplierPriceBreak(models.Model):
part = models.ForeignKey(SupplierPart, on_delete=models.CASCADE, related_name='pricebreaks')
quantity = models.PositiveIntegerField(default=1, validators=[MinValueValidator(1)])
quantity = models.DecimalField(max_digits=15, decimal_places=5, default=1, validators=[MinValueValidator(1)])
cost = models.DecimalField(max_digits=10, decimal_places=5, validators=[MinValueValidator(0)])

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-11-18 23:21+0000\n"
"POT-Creation-Date: 2019-11-18 23:29+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -141,59 +141,59 @@ msgstr ""
msgid "Confirm build completion"
msgstr ""
#: build/models.py:52
#: build/models.py:51
msgid "Brief description of the build"
msgstr ""
#: build/models.py:61
#: build/models.py:60
msgid "Select part to build"
msgstr ""
#: build/models.py:67
#: build/models.py:66
msgid ""
"Select location to take stock from for this build (leave blank to take from "
"any stock location)"
msgstr ""
#: build/models.py:73
#: build/models.py:72
msgid "Number of parts to build"
msgstr ""
#: build/models.py:79
#: build/models.py:78
msgid "Build status"
msgstr ""
#: build/models.py:82
#: build/models.py:81
msgid "Batch code for this build output"
msgstr ""
#: build/models.py:94
#: build/models.py:93
msgid "Link to external URL"
msgstr ""
#: build/models.py:96
#: build/models.py:95
msgid "Extra build notes"
msgstr ""
#: build/models.py:381
#: build/models.py:380
#, python-brace-format
msgid "Selected stock item not found in BOM for part '{p}'"
msgstr ""
#: build/models.py:384
#: build/models.py:383
#, python-brace-format
msgid "Allocated quantity ({n}) must not exceed available quantity ({q})"
msgstr ""
#: build/models.py:402
#: build/models.py:401
msgid "Build to allocate parts"
msgstr ""
#: build/models.py:409
#: build/models.py:408
msgid "Stock Item to allocate to build"
msgstr ""
#: build/models.py:417
#: build/models.py:416
msgid "Stock quantity to allocate to build"
msgstr ""
@ -211,6 +211,7 @@ msgstr ""
#: build/templates/build/allocate_edit.html:19
#: build/templates/build/allocate_view.html:17
#: order/templates/order/purchase_order_detail.html:104
msgid "Part"
msgstr ""
@ -237,6 +238,7 @@ msgid "Order Parts"
msgstr ""
#: build/templates/build/allocate_view.html:18
#: order/templates/order/purchase_order_detail.html:105
#: part/templates/part/detail.html:33
msgid "Description"
msgstr ""
@ -360,6 +362,60 @@ msgstr ""
msgid "Number of items received"
msgstr ""
#: order/templates/order/purchase_order_detail.html:60
msgid "Purchase Order Details"
msgstr ""
#: order/templates/order/purchase_order_detail.html:63
#: stock/templates/stock/item.html:125
msgid "Supplier"
msgstr ""
#: order/templates/order/purchase_order_detail.html:67
#: stock/templates/stock/item.html:146
msgid "Status"
msgstr ""
#: order/templates/order/purchase_order_detail.html:71
msgid "Created"
msgstr ""
#: order/templates/order/purchase_order_detail.html:76
msgid "Issued"
msgstr ""
#: order/templates/order/purchase_order_detail.html:82
#: order/templates/order/purchase_order_detail.html:110
msgid "Received"
msgstr ""
#: order/templates/order/purchase_order_detail.html:103
msgid "Line"
msgstr ""
#: order/templates/order/purchase_order_detail.html:106
msgid "Order Code"
msgstr ""
#: order/templates/order/purchase_order_detail.html:107
msgid "Reference"
msgstr ""
#: order/templates/order/purchase_order_detail.html:108
#: stock/templates/stock/item.html:89
#: stock/templates/stock/stock_adjust.html:20
msgid "Quantity"
msgstr ""
#: order/templates/order/purchase_order_detail.html:112
msgid "Note"
msgstr ""
#: order/templates/order/purchase_order_detail.html:165
#: part/templates/part/detail.html:152 stock/templates/stock/item.html:151
msgid "Notes"
msgstr ""
#: order/views.py:140
msgid "Confirm order cancellation"
msgstr ""
@ -739,10 +795,6 @@ msgstr ""
msgid "Part cannot be sold to customers"
msgstr ""
#: part/templates/part/detail.html:152 stock/templates/stock/item.html:151
msgid "Notes"
msgstr ""
#: part/templates/part/part_base.html:11
msgid "This part is not active"
msgstr ""
@ -1017,11 +1069,6 @@ msgstr ""
msgid "Serial Number"
msgstr ""
#: stock/templates/stock/item.html:89
#: stock/templates/stock/stock_adjust.html:20
msgid "Quantity"
msgstr ""
#: stock/templates/stock/item.html:95
msgid "Batch"
msgstr ""
@ -1030,10 +1077,6 @@ msgstr ""
msgid "Customer"
msgstr ""
#: stock/templates/stock/item.html:125
msgid "Supplier"
msgstr ""
#: stock/templates/stock/item.html:129
msgid "Supplier Part"
msgstr ""
@ -1050,10 +1093,6 @@ msgstr ""
msgid "No stocktake performed"
msgstr ""
#: stock/templates/stock/item.html:146
msgid "Status"
msgstr ""
#: stock/templates/stock/item.html:160
msgid "Stock Tracking Information"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-11-18 23:21+0000\n"
"POT-Creation-Date: 2019-11-18 23:29+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -141,59 +141,59 @@ msgstr ""
msgid "Confirm build completion"
msgstr ""
#: build/models.py:52
#: build/models.py:51
msgid "Brief description of the build"
msgstr ""
#: build/models.py:61
#: build/models.py:60
msgid "Select part to build"
msgstr ""
#: build/models.py:67
#: build/models.py:66
msgid ""
"Select location to take stock from for this build (leave blank to take from "
"any stock location)"
msgstr ""
#: build/models.py:73
#: build/models.py:72
msgid "Number of parts to build"
msgstr ""
#: build/models.py:79
#: build/models.py:78
msgid "Build status"
msgstr ""
#: build/models.py:82
#: build/models.py:81
msgid "Batch code for this build output"
msgstr ""
#: build/models.py:94
#: build/models.py:93
msgid "Link to external URL"
msgstr ""
#: build/models.py:96
#: build/models.py:95
msgid "Extra build notes"
msgstr ""
#: build/models.py:381
#: build/models.py:380
#, python-brace-format
msgid "Selected stock item not found in BOM for part '{p}'"
msgstr ""
#: build/models.py:384
#: build/models.py:383
#, python-brace-format
msgid "Allocated quantity ({n}) must not exceed available quantity ({q})"
msgstr ""
#: build/models.py:402
#: build/models.py:401
msgid "Build to allocate parts"
msgstr ""
#: build/models.py:409
#: build/models.py:408
msgid "Stock Item to allocate to build"
msgstr ""
#: build/models.py:417
#: build/models.py:416
msgid "Stock quantity to allocate to build"
msgstr ""
@ -211,6 +211,7 @@ msgstr ""
#: build/templates/build/allocate_edit.html:19
#: build/templates/build/allocate_view.html:17
#: order/templates/order/purchase_order_detail.html:104
msgid "Part"
msgstr ""
@ -237,6 +238,7 @@ msgid "Order Parts"
msgstr ""
#: build/templates/build/allocate_view.html:18
#: order/templates/order/purchase_order_detail.html:105
#: part/templates/part/detail.html:33
msgid "Description"
msgstr ""
@ -360,6 +362,60 @@ msgstr ""
msgid "Number of items received"
msgstr ""
#: order/templates/order/purchase_order_detail.html:60
msgid "Purchase Order Details"
msgstr ""
#: order/templates/order/purchase_order_detail.html:63
#: stock/templates/stock/item.html:125
msgid "Supplier"
msgstr ""
#: order/templates/order/purchase_order_detail.html:67
#: stock/templates/stock/item.html:146
msgid "Status"
msgstr ""
#: order/templates/order/purchase_order_detail.html:71
msgid "Created"
msgstr ""
#: order/templates/order/purchase_order_detail.html:76
msgid "Issued"
msgstr ""
#: order/templates/order/purchase_order_detail.html:82
#: order/templates/order/purchase_order_detail.html:110
msgid "Received"
msgstr ""
#: order/templates/order/purchase_order_detail.html:103
msgid "Line"
msgstr ""
#: order/templates/order/purchase_order_detail.html:106
msgid "Order Code"
msgstr ""
#: order/templates/order/purchase_order_detail.html:107
msgid "Reference"
msgstr ""
#: order/templates/order/purchase_order_detail.html:108
#: stock/templates/stock/item.html:89
#: stock/templates/stock/stock_adjust.html:20
msgid "Quantity"
msgstr ""
#: order/templates/order/purchase_order_detail.html:112
msgid "Note"
msgstr ""
#: order/templates/order/purchase_order_detail.html:165
#: part/templates/part/detail.html:152 stock/templates/stock/item.html:151
msgid "Notes"
msgstr ""
#: order/views.py:140
msgid "Confirm order cancellation"
msgstr ""
@ -739,10 +795,6 @@ msgstr ""
msgid "Part cannot be sold to customers"
msgstr ""
#: part/templates/part/detail.html:152 stock/templates/stock/item.html:151
msgid "Notes"
msgstr ""
#: part/templates/part/part_base.html:11
msgid "This part is not active"
msgstr ""
@ -1017,11 +1069,6 @@ msgstr ""
msgid "Serial Number"
msgstr ""
#: stock/templates/stock/item.html:89
#: stock/templates/stock/stock_adjust.html:20
msgid "Quantity"
msgstr ""
#: stock/templates/stock/item.html:95
msgid "Batch"
msgstr ""
@ -1030,10 +1077,6 @@ msgstr ""
msgid "Customer"
msgstr ""
#: stock/templates/stock/item.html:125
msgid "Supplier"
msgstr ""
#: stock/templates/stock/item.html:129
msgid "Supplier Part"
msgstr ""
@ -1050,10 +1093,6 @@ msgstr ""
msgid "No stocktake performed"
msgstr ""
#: stock/templates/stock/item.html:146
msgid "Status"
msgstr ""
#: stock/templates/stock/item.html:160
msgid "Stock Tracking Information"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-11-18 23:21+0000\n"
"POT-Creation-Date: 2019-11-18 23:29+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -141,59 +141,59 @@ msgstr ""
msgid "Confirm build completion"
msgstr ""
#: build/models.py:52
#: build/models.py:51
msgid "Brief description of the build"
msgstr ""
#: build/models.py:61
#: build/models.py:60
msgid "Select part to build"
msgstr ""
#: build/models.py:67
#: build/models.py:66
msgid ""
"Select location to take stock from for this build (leave blank to take from "
"any stock location)"
msgstr ""
#: build/models.py:73
#: build/models.py:72
msgid "Number of parts to build"
msgstr ""
#: build/models.py:79
#: build/models.py:78
msgid "Build status"
msgstr ""
#: build/models.py:82
#: build/models.py:81
msgid "Batch code for this build output"
msgstr ""
#: build/models.py:94
#: build/models.py:93
msgid "Link to external URL"
msgstr ""
#: build/models.py:96
#: build/models.py:95
msgid "Extra build notes"
msgstr ""
#: build/models.py:381
#: build/models.py:380
#, python-brace-format
msgid "Selected stock item not found in BOM for part '{p}'"
msgstr ""
#: build/models.py:384
#: build/models.py:383
#, python-brace-format
msgid "Allocated quantity ({n}) must not exceed available quantity ({q})"
msgstr ""
#: build/models.py:402
#: build/models.py:401
msgid "Build to allocate parts"
msgstr ""
#: build/models.py:409
#: build/models.py:408
msgid "Stock Item to allocate to build"
msgstr ""
#: build/models.py:417
#: build/models.py:416
msgid "Stock quantity to allocate to build"
msgstr ""
@ -211,6 +211,7 @@ msgstr ""
#: build/templates/build/allocate_edit.html:19
#: build/templates/build/allocate_view.html:17
#: order/templates/order/purchase_order_detail.html:104
msgid "Part"
msgstr ""
@ -237,6 +238,7 @@ msgid "Order Parts"
msgstr ""
#: build/templates/build/allocate_view.html:18
#: order/templates/order/purchase_order_detail.html:105
#: part/templates/part/detail.html:33
msgid "Description"
msgstr ""
@ -360,6 +362,60 @@ msgstr ""
msgid "Number of items received"
msgstr ""
#: order/templates/order/purchase_order_detail.html:60
msgid "Purchase Order Details"
msgstr ""
#: order/templates/order/purchase_order_detail.html:63
#: stock/templates/stock/item.html:125
msgid "Supplier"
msgstr ""
#: order/templates/order/purchase_order_detail.html:67
#: stock/templates/stock/item.html:146
msgid "Status"
msgstr ""
#: order/templates/order/purchase_order_detail.html:71
msgid "Created"
msgstr ""
#: order/templates/order/purchase_order_detail.html:76
msgid "Issued"
msgstr ""
#: order/templates/order/purchase_order_detail.html:82
#: order/templates/order/purchase_order_detail.html:110
msgid "Received"
msgstr ""
#: order/templates/order/purchase_order_detail.html:103
msgid "Line"
msgstr ""
#: order/templates/order/purchase_order_detail.html:106
msgid "Order Code"
msgstr ""
#: order/templates/order/purchase_order_detail.html:107
msgid "Reference"
msgstr ""
#: order/templates/order/purchase_order_detail.html:108
#: stock/templates/stock/item.html:89
#: stock/templates/stock/stock_adjust.html:20
msgid "Quantity"
msgstr ""
#: order/templates/order/purchase_order_detail.html:112
msgid "Note"
msgstr ""
#: order/templates/order/purchase_order_detail.html:165
#: part/templates/part/detail.html:152 stock/templates/stock/item.html:151
msgid "Notes"
msgstr ""
#: order/views.py:140
msgid "Confirm order cancellation"
msgstr ""
@ -739,10 +795,6 @@ msgstr ""
msgid "Part cannot be sold to customers"
msgstr ""
#: part/templates/part/detail.html:152 stock/templates/stock/item.html:151
msgid "Notes"
msgstr ""
#: part/templates/part/part_base.html:11
msgid "This part is not active"
msgstr ""
@ -1017,11 +1069,6 @@ msgstr ""
msgid "Serial Number"
msgstr ""
#: stock/templates/stock/item.html:89
#: stock/templates/stock/stock_adjust.html:20
msgid "Quantity"
msgstr ""
#: stock/templates/stock/item.html:95
msgid "Batch"
msgstr ""
@ -1030,10 +1077,6 @@ msgstr ""
msgid "Customer"
msgstr ""
#: stock/templates/stock/item.html:125
msgid "Supplier"
msgstr ""
#: stock/templates/stock/item.html:129
msgid "Supplier Part"
msgstr ""
@ -1050,10 +1093,6 @@ msgstr ""
msgid "No stocktake performed"
msgstr ""
#: stock/templates/stock/item.html:146
msgid "Status"
msgstr ""
#: stock/templates/stock/item.html:160
msgid "Stock Tracking Information"
msgstr ""

View File

@ -0,0 +1,19 @@
# Generated by Django 2.2.5 on 2019-11-18 23:23
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('order', '0012_auto_20190617_1943'),
]
operations = [
migrations.AlterField(
model_name='purchaseorderlineitem',
name='quantity',
field=models.DecimalField(decimal_places=5, default=1, help_text='Item quantity', max_digits=15, validators=[django.core.validators.MinValueValidator(0)]),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 2.2.5 on 2019-11-18 23:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('order', '0013_auto_20191118_2323'),
]
operations = [
migrations.AlterField(
model_name='purchaseorderlineitem',
name='received',
field=models.DecimalField(decimal_places=5, default=0, help_text='Number of items received', max_digits=15),
),
]

View File

@ -242,7 +242,7 @@ class OrderLineItem(models.Model):
class Meta:
abstract = True
quantity = models.PositiveIntegerField(validators=[MinValueValidator(0)], default=1, help_text=_('Item quantity'))
quantity = models.DecimalField(max_digits=15, decimal_places=5, validators=[MinValueValidator(0)], default=1, help_text=_('Item quantity'))
reference = models.CharField(max_length=100, blank=True, help_text=_('Line item reference'))
@ -284,7 +284,7 @@ class PurchaseOrderLineItem(OrderLineItem):
help_text=_("Supplier part"),
)
received = models.PositiveIntegerField(default=0, help_text=_('Number of items received'))
received = models.DecimalField(decimal_places=5, max_digits=15, default=0, help_text=_('Number of items received'))
def remaining(self):
""" Calculate the number of items remaining to be received """

View File

@ -1,6 +1,8 @@
{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% load inventree_extras %}
{% block page_title %}
InvenTree | {{ order }}
@ -55,29 +57,29 @@ InvenTree | {{ order }}
</div>
</div>
<div class='col-sm-6'>
<h4>Purchase Order Details</h4>
<h4>{% trans "Purchase Order Details" %}</h4>
<table class='table'>
<tr>
<td>Supplier</td>
<td>{% trans "Supplier" %}</td>
<td><a href="{% url 'company-detail' order.supplier.id %}">{{ order.supplier }}</a></td>
</tr>
<tr>
<td>Status</td>
<td>{% trans "Status" %}</td>
<td>{% include "order/order_status.html" %}</td>
</tr>
<tr>
<td>Created</td>
<td>{% trans "Created" %}</td>
<td>{{ order.creation_date }}<span class='badge'>{{ order.created_by }}</span></td>
</tr>
{% if order.issue_date %}
<tr>
<td>Issued</td>
<td>{% trans "Issued" %}</td>
<td>{{ order.issue_date }}</td>
</tr>
{% endif %}
{% if order.status == OrderStatus.COMPLETE %}
<tr>
<td>Received</td>
<td>{% trans "Received" %}</td>
<td>{{ order.complete_date }}<span class='badge'>{{ order.received_by }}</span></td>
</tr>
{% endif %}
@ -98,16 +100,16 @@ InvenTree | {{ order }}
<table class='table table-striped table-condensed' id='po-lines-table' data-toolbar='#order-toolbar-buttons'>
<thead>
<tr>
<th data-sortable='true'>Line</th>
<th data-sortable='true'>Part</th>
<th>Description</th>
<th data-sortable='true'>Order Code</th>
<th data-sortable='true'>Reference</th>
<th data-sortable='true'>Quantity</th>
<th data-sortable='true'>{% trans "Line" %}</th>
<th data-sortable='true'>{% trans "Part" %}</th>
<th>{% trans "Description" %}</th>
<th data-sortable='true'>{% trans "Order Code" %}</th>
<th data-sortable='true'>{% trans "Reference" %}</th>
<th data-sortable='true'>{% trans "Quantity" %}</th>
{% if not order.status == OrderStatus.PENDING %}
<th data-sortable='true'>Received</th>
<th data-sortable='true'>{% trans "Received" %}</th>
{% endif %}
<th>Note</th>
<th>{% trans "Note" %}</th>
<th></th>
</tr>
</thead>
@ -128,9 +130,9 @@ InvenTree | {{ order }}
<td colspan='3'><strong>Warning: Part has been deleted.</strong></td>
{% endif %}
<td>{{ line.reference }}</td>
<td>{{ line.quantity }}</td>
<td>{% decimal line.quantity %}</td>
{% if not order.status == OrderStatus.PENDING %}
<td>{{ line.received }}</td>
<td>{% decimal line.received %}</td>
{% endif %}
<td>
{{ line.notes }}
@ -160,7 +162,7 @@ InvenTree | {{ order }}
{% if order.notes %}
<hr>
<div class='panel panel-default'>
<div class='panel-heading'><b>Notes</b></div>
<div class='panel-heading'><b>{% trans "Notes" %}</b></div>
<div class='panel-body'>{{ order.notes }}</div>
</div>
{% endif %}