2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Add support for recursively delete the stock locations (#3926)

This commit is contained in:
Miklós Márton
2022-11-13 22:07:16 +01:00
committed by GitHub
parent 60e44700a9
commit 8ceb1af3c3
4 changed files with 187 additions and 23 deletions

View File

@ -171,16 +171,35 @@ function deleteStockLocation(pk, options={}) {
var html = `
<div class='alert alert-block alert-danger'>
{% trans "Are you sure you want to delete this stock location?" %}
<ul>
<li>{% trans "Any child locations will be moved to the parent of this location" %}</li>
<li>{% trans "Any stock items in this location will be moved to the parent of this location" %}</li>
</ul>
</div>
`;
var subChoices = [
{
value: 0,
display_name: '{% trans "Move to parent stock location" %}',
},
{
value: 1,
display_name: '{% trans "Delete" %}',
}
];
constructForm(url, {
title: '{% trans "Delete Stock Location" %}',
method: 'DELETE',
fields: {
'delete_stock_items': {
label: '{% trans "Action for stock items in this stock location" %}',
choices: subChoices,
type: 'choice'
},
'delete_sub_locations': {
label: '{% trans "Action for sub-locations" %}',
choices: subChoices,
type: 'choice'
},
},
preFormContent: html,
onSuccess: function(response) {
handleFormSuccess(response, options);