diff --git a/InvenTree/order/forms.py b/InvenTree/order/forms.py
index 8432d9a6ef..97e0f0bdd9 100644
--- a/InvenTree/order/forms.py
+++ b/InvenTree/order/forms.py
@@ -27,6 +27,17 @@ class IssuePurchaseOrderForm(HelperForm):
]
+class CompletePurchaseOrderForm(HelperForm):
+
+ confirm = forms.BooleanField(required=False, help_text=_("Mark order as complete"))
+
+ class Meta:
+ model = PurchaseOrder
+ fields = [
+ 'confirm',
+ ]
+
+
class CancelPurchaseOrderForm(HelperForm):
confirm = forms.BooleanField(required=False, help_text=_('Cancel order'))
diff --git a/InvenTree/order/models.py b/InvenTree/order/models.py
index b1b93b990a..c0be887fe1 100644
--- a/InvenTree/order/models.py
+++ b/InvenTree/order/models.py
@@ -188,6 +188,12 @@ class PurchaseOrder(Order):
return self.lines.filter(quantity__gt=F('received'))
+ @property
+ def is_complete(self):
+ """ Return True if all line items have been received """
+
+ return self.pending_line_items().count() == 0
+
@transaction.atomic
def receive_line_item(self, line, location, quantity, user):
""" Receive a line item (or partial line item) against this PO
diff --git a/InvenTree/order/templates/order/order_complete.html b/InvenTree/order/templates/order/order_complete.html
new file mode 100644
index 0000000000..f6b9f14338
--- /dev/null
+++ b/InvenTree/order/templates/order/order_complete.html
@@ -0,0 +1,13 @@
+{% extends "modal_form.html" %}
+
+{% block pre_form_content %}
+
+Mark this order as complete?
+{% if not order.is_complete %}
+
+ This order has line items which have not been marked as received.
+ Marking this order as complete will remove these line items.
+
+{% endif %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html
index 0ee447ef0e..d7d34103b1 100644
--- a/InvenTree/order/templates/order/purchase_order_detail.html
+++ b/InvenTree/order/templates/order/purchase_order_detail.html
@@ -44,6 +44,9 @@ InvenTree | {{ order }}
+
{% endif %}
{% if order.status == OrderStatus.PENDING or order.status == OrderStatus.PLACED %}