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

Replace the existing CancelPurchaseOrderForm with an API driven form

This commit is contained in:
Oliver Walters
2022-05-04 15:14:14 +10:00
parent e920fc31e7
commit 62cd0f39c7
7 changed files with 37 additions and 52 deletions

View File

@ -123,6 +123,9 @@ function getApiEndpointOptions(url, callback) {
return;
}
// Include extra context information in the request
url += '?context=true'
// Return the ajax request object
$.ajax({
url: url,

View File

@ -20,6 +20,7 @@
/* exported
allocateStockToSalesOrder,
cancelPurchaseOrder,
completeShipment,
createSalesOrder,
createSalesOrderShipment,
@ -141,6 +142,30 @@ function completeShipment(shipment_id) {
}
function cancelPurchaseOrder(order_id, options={}) {
var html = `
<div class='alert alert-info alert-block'>
{% trans "Are you sure you wish to cancel this purchase order?" %}
</div>`;
constructForm(
`/api/order/po/${order_id}/cancel/`,
{
method: 'POST',
title: '{% trans "Cancel Purchase Order" %}',
confirm: true,
preFormContent: html,
onSuccess: function(response) {
if (options.onSuccess) {
options.onSuccess(response);
}
}
}
);
}
// Open a dialog to create a new sales order shipment
function createSalesOrderShipment(options={}) {