Business logic

This commit is contained in:
Oliver Walters 2019-06-10 22:17:19 +10:00
parent ec669dd670
commit 228bf4e1da
2 changed files with 6 additions and 2 deletions

View File

@ -64,7 +64,9 @@ InvenTree | {{ order }}
<h4>Order Items</h4>
{% if order.status == OrderStatus.PENDING %}
<button type='button' class='btn btn-default' id='new-po-line'>Add Line Item</button>
{% endif %}
<table class='table table-striped table-condensed' id='po-lines-table'>
<tr>
@ -118,6 +120,7 @@ $("#edit-order").click(function() {
);
});
{% if order.status == OrderStatus.PENDING %}
$('#new-po-line').click(function() {
launchModalForm("{% url 'po-line-item-create' %}",
{
@ -139,6 +142,7 @@ $('#new-po-line').click(function() {
}
);
});
{% endif %}
$("#po-lines-table").bootstrapTable({
});

View File

@ -87,7 +87,7 @@ class PurchaseOrderEdit(AjaxUpdateView):
order = self.get_object()
# Prevent user from editing supplier if there are already lines in the order
if order.lines.count() > 0:
if order.lines.count() > 0 or not order.status == OrderStatus.PENDING:
form.fields['supplier'].widget = HiddenInput()
return form
@ -121,7 +121,7 @@ class PurchaseOrderIssue(AjaxUpdateView):
}
if valid:
order.issue_order()
order.place_order()
return self.renderJsonResponse(request, form, data)