From 83256b10147b72fee35ed593f52bf19fcc3092ec Mon Sep 17 00:00:00 2001 From: Oliver Date: Sat, 3 Jul 2021 16:10:41 +1000 Subject: [PATCH] Refactor BomItemDelete form --- InvenTree/part/templates/part/bom-delete.html | 16 ---------------- InvenTree/part/urls.py | 1 - InvenTree/part/views.py | 13 +++---------- InvenTree/templates/js/bom.js | 13 ++++++------- 4 files changed, 9 insertions(+), 34 deletions(-) delete mode 100644 InvenTree/part/templates/part/bom-delete.html diff --git a/InvenTree/part/templates/part/bom-delete.html b/InvenTree/part/templates/part/bom-delete.html deleted file mode 100644 index c2db77c040..0000000000 --- a/InvenTree/part/templates/part/bom-delete.html +++ /dev/null @@ -1,16 +0,0 @@ -{% extends "modal_delete_form.html" %} -{% load i18n %} - -{% block pre_form_content %} - -{% trans "Are you sure you want to delete this BOM item?" %} -
-{% trans "Deleting this entry will remove the BOM row from the following part" %}: - - - -{% endblock %} \ No newline at end of file diff --git a/InvenTree/part/urls.py b/InvenTree/part/urls.py index 10f21c82d2..96560a7ad7 100644 --- a/InvenTree/part/urls.py +++ b/InvenTree/part/urls.py @@ -109,7 +109,6 @@ category_urls = [ part_bom_urls = [ url(r'^edit/?', views.BomItemEdit.as_view(), name='bom-item-edit'), - url('^delete/?', views.BomItemDelete.as_view(), name='bom-item-delete'), ] # URL list for part web interface diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index 2d5ffbe231..d9f79262d1 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -2778,17 +2778,10 @@ class BomItemEdit(AjaxUpdateView): return form -class BomItemDelete(AjaxDeleteView): - """ Delete view for removing BomItem """ - - model = BomItem - ajax_template_name = 'part/bom-delete.html' - context_object_name = 'item' - ajax_form_title = _('Confim BOM item deletion') - - class PartSalePriceBreakCreate(AjaxCreateView): - """ View for creating a sale price break for a part """ + """ + View for creating a sale price break for a part + """ model = PartSellPriceBreak form_class = part_forms.EditPartSalePriceBreakForm diff --git a/InvenTree/templates/js/bom.js b/InvenTree/templates/js/bom.js index 665379d8d5..980dd82ccc 100644 --- a/InvenTree/templates/js/bom.js +++ b/InvenTree/templates/js/bom.js @@ -514,14 +514,13 @@ function loadBomTable(table, options) { var pk = $(this).attr('pk'); var url = `/part/bom/${pk}/delete/`; - launchModalForm( - url, - { - success: function() { - reloadBomTable(table); - } + constructForm(`/api/bom/${pk}/`, { + method: 'DELETE', + title: '{% trans "Delete BOM Item" %}', + onSuccess: function() { + reloadBomTable(table); } - ); + }); }); table.on('click', '.bom-edit-button', function() {