2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-12-14 08:19:54 +00:00

Converting more forms to the API (#3181)

* Delete category via the API

* Delete StockLocation via the API

* Delete StockItem via the API

- Removes the final instance of AjaxDelete

* Remove URL path

* Add missing code
This commit is contained in:
Oliver
2022-06-11 21:53:26 +10:00
committed by GitHub
parent 63f1e58ca9
commit 090f4f4387
14 changed files with 100 additions and 249 deletions

View File

@@ -6,8 +6,7 @@ from django.utils.translation import gettext_lazy as _
from django.views.generic import DetailView, ListView
import common.settings
from InvenTree.views import (AjaxDeleteView, AjaxUpdateView,
InvenTreeRoleMixin, QRCodeView)
from InvenTree.views import AjaxUpdateView, InvenTreeRoleMixin, QRCodeView
from plugin.views import InvenTreePluginViewMixin
from . import forms as StockForms
@@ -163,29 +162,3 @@ class StockItemConvert(AjaxUpdateView):
stock_item.convert_to_variant(variant, user=self.request.user)
return stock_item
class StockLocationDelete(AjaxDeleteView):
"""View to delete a StockLocation.
Presents a deletion confirmation form to the user
"""
model = StockLocation
success_url = '/stock'
ajax_template_name = 'stock/location_delete.html'
context_object_name = 'location'
ajax_form_title = _('Delete Stock Location')
class StockItemDelete(AjaxDeleteView):
"""View to delete a StockItem.
Presents a deletion confirmation form to the user
"""
model = StockItem
success_url = '/stock/'
ajax_template_name = 'stock/item_delete.html'
context_object_name = 'item'
ajax_form_title = _('Delete Stock Item')