mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Separate display of open and closed purchase orders (per part)
This commit is contained in:
parent
228bf4e1da
commit
b8bcc5ce0c
@ -33,7 +33,7 @@ from InvenTree import helpers
|
|||||||
from InvenTree import validators
|
from InvenTree import validators
|
||||||
from InvenTree.models import InvenTreeTree
|
from InvenTree.models import InvenTreeTree
|
||||||
|
|
||||||
from InvenTree.status_codes import BuildStatus, StockStatus
|
from InvenTree.status_codes import BuildStatus, StockStatus, OrderStatus
|
||||||
|
|
||||||
from company.models import SupplierPart
|
from company.models import SupplierPart
|
||||||
|
|
||||||
@ -806,6 +806,16 @@ class Part(models.Model):
|
|||||||
|
|
||||||
return orders
|
return orders
|
||||||
|
|
||||||
|
def open_purchase_orders(self):
|
||||||
|
""" Return a list of open purchase orders against this part """
|
||||||
|
|
||||||
|
return [order for order in self.purchase_orders() if order.status in OrderStatus.OPEN]
|
||||||
|
|
||||||
|
def closed_purchase_orders(self):
|
||||||
|
""" Return a list of closed purchase orders against this part """
|
||||||
|
|
||||||
|
return [order for order in self.purchase_orders() if order.status not in OrderStatus.OPEN]
|
||||||
|
|
||||||
def on_order(self):
|
def on_order(self):
|
||||||
""" Return the total number of items on order for this part. """
|
""" Return the total number of items on order for this part. """
|
||||||
|
|
||||||
|
@ -7,12 +7,17 @@
|
|||||||
|
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-sm-6'>
|
<div class='col-sm-6'>
|
||||||
<h4>Part Orders</h4>
|
<h4>Open Part Orders</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-sm-6'>
|
<div class='col-sm-6'>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% include "order/po_table.html" with orders=part.purchase_orders %}
|
{% include "order/po_table.html" with orders=part.open_purchase_orders %}
|
||||||
|
|
||||||
|
{% if part.closed_purchase_orders|length > 0 %}
|
||||||
|
<h4>Closed Orders</h4>
|
||||||
|
{% include "order/po_table.html" with orders=part.closed_purchase_orders %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user