diff --git a/InvenTree/company/templates/company/company_base.html b/InvenTree/company/templates/company/company_base.html index 88b9f2958d..dcf7d9d3a4 100644 --- a/InvenTree/company/templates/company/company_base.html +++ b/InvenTree/company/templates/company/company_base.html @@ -126,11 +126,11 @@ $('#company-delete').click(function() { - launchModalForm( - "{% url 'company-delete' company.id %}", - { - redirect: "{% url 'company-index' %}" - }); + constructForm('{% url "api-company-detail" company.pk %}', { + method: 'DELETE', + title: '{% trans "Delete Company" %}', + redirect: '{% url "company-index" %}', + }); }); function reloadImage(data) { diff --git a/InvenTree/company/templates/company/delete.html b/InvenTree/company/templates/company/delete.html deleted file mode 100644 index 3236a7a58d..0000000000 --- a/InvenTree/company/templates/company/delete.html +++ /dev/null @@ -1,21 +0,0 @@ -{% extends "modal_delete_form.html" %} - -{% load i18n %} - -{% block pre_form_content %} - -{% blocktrans with company.name as name %}Are you sure you want to delete company '{{ name }}'?{% endblocktrans %} - -
- -{% if company.supplied_part_count > 0 %} -

{% blocktrans with company.supplied_part_count as count %}There are {{ count }} parts sourced from this company.
-If this supplier is deleted, these supplier part entries will also be deleted.{% endblocktrans %}

- -{% endif %} - -{% endblock %} \ No newline at end of file diff --git a/InvenTree/company/urls.py b/InvenTree/company/urls.py index 105d7e89a2..4fe0519ea9 100644 --- a/InvenTree/company/urls.py +++ b/InvenTree/company/urls.py @@ -8,8 +8,6 @@ from . import views company_detail_urls = [ - url(r'delete/?', views.CompanyDelete.as_view(), name='company-delete'), - # url(r'orders/?', views.CompanyDetail.as_view(template_name='company/orders.html'), name='company-detail-orders'), url(r'^supplier-parts/', views.CompanyDetail.as_view(template_name='company/detail_supplier_part.html'), name='company-detail-supplier-parts'), diff --git a/InvenTree/company/views.py b/InvenTree/company/views.py index 9c28f56fa8..60c37a392a 100644 --- a/InvenTree/company/views.py +++ b/InvenTree/company/views.py @@ -228,22 +228,6 @@ class CompanyImageDownloadFromURL(AjaxUpdateView): ) -class CompanyDelete(AjaxDeleteView): - """ View for deleting a Company object """ - - model = Company - success_url = '/company/' - ajax_template_name = 'company/delete.html' - ajax_form_title = _('Delete Company') - context_object_name = 'company' - permission_required = 'company.delete_company' - - def get_data(self): - return { - 'danger': _('Company was deleted'), - } - - class ManufacturerPartDetail(DetailView): """ Detail view for ManufacturerPart """ model = ManufacturerPart