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:
@ -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,
|
||||
|
@ -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={}) {
|
||||
|
||||
|
Reference in New Issue
Block a user