mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 13:15:43 +00:00 
			
		
		
		
	Separate display of open and closed purchase orders (per part)
This commit is contained in:
		| @@ -33,7 +33,7 @@ from InvenTree import helpers | ||||
| from InvenTree import validators | ||||
| 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 | ||||
|  | ||||
| @@ -806,6 +806,16 @@ class Part(models.Model): | ||||
|  | ||||
|         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): | ||||
|         """ Return the total number of items on order for this part. """ | ||||
|  | ||||
|   | ||||
| @@ -7,12 +7,17 @@ | ||||
|  | ||||
| <div class='row'> | ||||
|     <div class='col-sm-6'> | ||||
|         <h4>Part Orders</h4> | ||||
|         <h4>Open Part Orders</h4> | ||||
|     </div> | ||||
|     <div class='col-sm-6'> | ||||
|     </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 %} | ||||
		Reference in New Issue
	
	Block a user