mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
"Validate BOM" now uses the API also
This commit is contained in:
@ -207,6 +207,11 @@ function showApiError(xhr, url) {
|
||||
title = '{% trans "Error 404: Resource Not Found" %}';
|
||||
message = '{% trans "The requested resource could not be located on the server" %}';
|
||||
break;
|
||||
// Method not allowed
|
||||
case 405:
|
||||
title = '{% trans "Error 405: Method Not Allowed" %}';
|
||||
message = '{% trans "HTTP method not allowed at URL" %}';
|
||||
break;
|
||||
// Timeout
|
||||
case 408:
|
||||
title = '{% trans "Error 408: Timeout" %}';
|
||||
|
@ -40,6 +40,7 @@
|
||||
loadStockPricingChart,
|
||||
partStockLabel,
|
||||
toggleStar,
|
||||
validateBom,
|
||||
*/
|
||||
|
||||
/* Part API functions
|
||||
@ -429,9 +430,34 @@ function toggleStar(options) {
|
||||
}
|
||||
|
||||
|
||||
/* Validate a BOM */
|
||||
function validateBom(part_id, options={}) {
|
||||
|
||||
var html = `
|
||||
<div class='alert alert-block alert-success'>
|
||||
{% trans "Validating the BOM will mark each line item as valid" %}
|
||||
</div>
|
||||
`;
|
||||
|
||||
constructForm(`/api/part/${part_id}/bom-validate/`, {
|
||||
method: 'PUT',
|
||||
fields: {
|
||||
valid: {},
|
||||
},
|
||||
preFormContent: html,
|
||||
title: '{% trans "Validate Bill of Materials" %}',
|
||||
reload: options.reload,
|
||||
onSuccess: function(response) {
|
||||
showMessage('{% trans "Validated Bill of Materials" %}');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* Duplicate a BOM */
|
||||
function duplicateBom(part_id, options={}) {
|
||||
constructForm(`/api/part/${part_id}/copy-bom/`, {
|
||||
|
||||
constructForm(`/api/part/${part_id}/bom-copy/`, {
|
||||
method: 'POST',
|
||||
fields: {
|
||||
part: {
|
||||
|
Reference in New Issue
Block a user