diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index b91ff53118..0228c4df66 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -130,7 +130,7 @@ {% if roles.part.change %}
  • {% trans "Edit part" %}
  • {% endif %} - {% if not part.active and roles.part.delete %} + {% if roles.part.delete %}
  • {% trans "Delete part" %}
  • {% endif %} @@ -503,7 +503,7 @@ }); {% endif %} - {% if not part.active and roles.part.delete %} + {% if roles.part.delete %} $("#part-delete").click(function() { launchModalForm( "{% url 'part-delete' part.id %}", diff --git a/InvenTree/part/templates/part/partial_delete.html b/InvenTree/part/templates/part/partial_delete.html index 993d7a418c..eb23fbee09 100644 --- a/InvenTree/part/templates/part/partial_delete.html +++ b/InvenTree/part/templates/part/partial_delete.html @@ -3,6 +3,16 @@ {% block pre_form_content %} +{% if part.active %} + +
    + {% blocktrans with full_name=part.full_name %}Part '{{full_name}}' cannot be deleted as it is still marked as active. +
    Disable the "Active" part attribute and re-try. + {% endblocktrans %} +
    + +{% else %} +
    {% blocktrans with full_name=part.full_name %}Are you sure you want to delete part '{{full_name}}'?{% endblocktrans %}
    @@ -55,4 +65,12 @@

    {% blocktrans with count=part.serials.all|length full_name=part.full_name %}There are {{count}} unique parts tracked for '{{full_name}}'. Deleting this part will permanently remove this tracking information.{% endblocktrans %}

    {% endif %} +{% endif %} + +{% endblock %} + +{% block form %} +{% if not part.active %} +{{ block.super }} +{% endif %} {% endblock %} \ No newline at end of file