mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-01 03:00:54 +00:00
Refactor delete view for PartAttachment and StockItemAttachment
This commit is contained in:
@ -73,12 +73,15 @@ $("#attachment-table").on('click', '.attachment-edit-button', function() {
|
||||
$("#attachment-table").on('click', '.attachment-delete-button', function() {
|
||||
var button = $(this);
|
||||
|
||||
var url = `/stock/item/attachment/${button.attr('pk')}/delete/`;
|
||||
var pk = button.attr('pk');
|
||||
|
||||
launchModalForm(url, {
|
||||
success: function() {
|
||||
location.reload();
|
||||
}
|
||||
var url = `/api/stock/attachment/${pk}/`;
|
||||
|
||||
constructForm(url, {
|
||||
method: 'DELETE',
|
||||
confirmMessage: '{% trans "Confirm Delete Operation" %}',
|
||||
title: '{% trans "Delete Attachment" %}',
|
||||
reload: true,
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -62,11 +62,6 @@ stock_urls = [
|
||||
|
||||
url(r'^item/uninstall/', views.StockItemUninstall.as_view(), name='stock-item-uninstall'),
|
||||
|
||||
# URLs for StockItem attachments
|
||||
url(r'^item/attachment/', include([
|
||||
url(r'^(?P<pk>\d+)/delete/', views.StockItemAttachmentDelete.as_view(), name='stock-item-attachment-delete'),
|
||||
])),
|
||||
|
||||
# URLs for StockItem tests
|
||||
url(r'^item/test/', include([
|
||||
url(r'^new/', views.StockItemTestResultCreate.as_view(), name='stock-item-test-create'),
|
||||
|
@ -32,7 +32,7 @@ from datetime import datetime, timedelta
|
||||
|
||||
from company.models import Company, SupplierPart
|
||||
from part.models import Part
|
||||
from .models import StockItem, StockLocation, StockItemTracking, StockItemAttachment, StockItemTestResult
|
||||
from .models import StockItem, StockLocation, StockItemTracking, StockItemTestResult
|
||||
|
||||
import common.settings
|
||||
from common.models import InvenTreeSetting
|
||||
@ -255,22 +255,6 @@ class StockLocationQRCode(QRCodeView):
|
||||
return None
|
||||
|
||||
|
||||
class StockItemAttachmentDelete(AjaxDeleteView):
|
||||
"""
|
||||
View for deleting a StockItemAttachment object.
|
||||
"""
|
||||
|
||||
model = StockItemAttachment
|
||||
ajax_form_title = _("Delete Stock Item Attachment")
|
||||
ajax_template_name = "attachment_delete.html"
|
||||
context_object_name = "attachment"
|
||||
|
||||
def get_data(self):
|
||||
return {
|
||||
'danger': _("Deleted attachment"),
|
||||
}
|
||||
|
||||
|
||||
class StockItemAssignToCustomer(AjaxUpdateView):
|
||||
"""
|
||||
View for manually assigning a StockItem to a Customer
|
||||
|
Reference in New Issue
Block a user