2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 04:55:44 +00:00

Replace PurchaseOrderComplete form

This commit is contained in:
Oliver Walters
2022-05-04 15:33:50 +10:00
parent e527ddcc86
commit 5afc3bfce2
8 changed files with 88 additions and 70 deletions

View File

@ -21,6 +21,7 @@
/* exported
allocateStockToSalesOrder,
cancelPurchaseOrder,
completePurchaseOrder,
completeShipment,
createSalesOrder,
createSalesOrderShipment,
@ -142,6 +143,46 @@ function completeShipment(shipment_id) {
}
function completePurchaseOrder(order_id, options={}) {
constructForm(
`/api/order/po/${order_id}/complete/`,
{
method: 'POST',
title: '{% trans "Complete Purchase Order" %}',
confirm: true,
preFormContent: function(opts) {
var html = `
<div class='alert alert-block alert-info'>
{% trans "Mark this order as complete?" %}
</div>`;
if (opts.context.is_complete) {
html += `
<div class='alert alert-block alert-success'>
{% trans "All line items have been received" %}
</div>`;
} else {
html += `
<div class='alert alert-block alert-warning'>
{% trans 'This order has line items which have not been marked as received.' %}</br>
{% trans 'Completing this order means that the order and line items will no longer be editable.' %}
</div>`;
}
return html;
},
onSuccess: function(response) {
if (options.onSuccess) {
options.onSuccess(response);
}
}
}
);
}
function cancelPurchaseOrder(order_id, options={}) {
var html = `