diff --git a/InvenTree/InvenTree/views.py b/InvenTree/InvenTree/views.py index 041603f7fb..9d5e1a2dc4 100644 --- a/InvenTree/InvenTree/views.py +++ b/InvenTree/InvenTree/views.py @@ -245,6 +245,7 @@ class AjaxCreateView(AjaxMixin, CreateView): # Return the PK of the newly-created object data['pk'] = obj.pk + data['text'] = str(obj) try: data['url'] = obj.get_absolute_url() diff --git a/InvenTree/build/templates/build/allocate.html b/InvenTree/build/templates/build/allocate.html index 9a0f045c68..5b66ef6b57 100644 --- a/InvenTree/build/templates/build/allocate.html +++ b/InvenTree/build/templates/build/allocate.html @@ -34,7 +34,6 @@ InvenTree | Allocate Parts {% block js_load %} {{ block.super }} - {% endblock %} diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 3aeb94700a..d255a319f3 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -670,6 +670,7 @@ class BomItem(models.Model): # A link to the parent part # Each part will get a reverse lookup field 'bom_items' part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='bom_items', + help_text='Select parent part', limit_choices_to={ 'buildable': True, 'active': True, @@ -678,16 +679,17 @@ class BomItem(models.Model): # A link to the child item (sub-part) # Each part will get a reverse lookup field 'used_in' sub_part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='used_in', + help_text='Select part to be used in BOM', limit_choices_to={ 'consumable': True, 'active': True }) # Quantity required - quantity = models.PositiveIntegerField(default=1, validators=[MinValueValidator(0)]) + quantity = models.PositiveIntegerField(default=1, validators=[MinValueValidator(0)], help_text='BOM quantity for this BOM item') # Note attached to this BOM line item - note = models.CharField(max_length=100, blank=True, help_text='Item notes') + note = models.CharField(max_length=100, blank=True, help_text='BOM item notes') def clean(self): """ Check validity of the BomItem model. @@ -767,7 +769,7 @@ class SupplierPart(models.Model): MPN = models.CharField(max_length=100, blank=True, help_text='Manufacturer part number') - URL = models.URLField(blank=True) + URL = models.URLField(blank=True, help_text='URL for external supplier part link') description = models.CharField(max_length=250, blank=True, help_text='Supplier part description') diff --git a/InvenTree/part/templates/part/bom.html b/InvenTree/part/templates/part/bom.html index 295fed23d6..3990bfab6c 100644 --- a/InvenTree/part/templates/part/bom.html +++ b/InvenTree/part/templates/part/bom.html @@ -56,8 +56,6 @@ {% block js_load %} {{ block.super }} - - {% endblock %} @@ -83,7 +81,15 @@ { success: function() { $("#bom-table").bootstrapTable('refresh'); - } + }, + secondary: [ + { + field: 'sub_part', + label: 'New Part', + title: 'Create New Part', + url: "{% url 'part-create' %}", + }, + ] } ); }); diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index 286b5fc418..3abef26af9 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -61,8 +61,6 @@ {% endblock %} {% block js_load %} {{ block.super }} - - {% endblock %} {% block js_ready %} {{ block.super }} @@ -82,15 +80,30 @@ $("#part-create").click(function() { launchModalForm( - "{% url 'part-create' %}", - { - follow: true, - data: { - {% if category %} - category: {{ category.id }} - {% endif %} - } - }); + "{% url 'part-create' %}", + { + follow: true, + data: { + {% if category %} + category: {{ category.id }} + {% endif %} + }, + secondary: [ + { + field: 'category', + label: 'New Category', + title: 'Create new Part Category', + url: "{% url 'category-create' %}", + }, + { + field: 'default_location', + label: 'New Location', + title: 'Create new Stock Location', + url: "{% url 'stock-location-create' %}", + } + ] + } + ); }); {% if category %} diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index a7bad6cae4..787e071036 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -20,6 +20,7 @@
  • Deactivate
  • {% else %}
  • Activate
  • +
  • Delete
  • {% endif %} @@ -128,8 +129,6 @@ {% block js_load %} {{ block.super }} - - {% endblock %} {% block js_ready %} @@ -200,10 +199,10 @@ $('#delete-part').click(function() { launchModalForm( - "{% url 'part-delete' part.id %}", - { - redirect: {% if part.category %}"{% url 'category-detail' part.category.id %}"{% else %}"{% url 'part-index' %}"{% endif %} - }); + "{% url 'part-delete' part.id %}", + { + redirect: {% if part.category %}"{% url 'category-detail' part.category.id %}"{% else %}"{% url 'part-index' %}"{% endif %} + }); }); {% endblock %} diff --git a/InvenTree/part/templates/part/part_app_base.html b/InvenTree/part/templates/part/part_app_base.html index 95c3f26c28..adf9d67617 100644 --- a/InvenTree/part/templates/part/part_app_base.html +++ b/InvenTree/part/templates/part/part_app_base.html @@ -29,6 +29,7 @@ InvenTree | Part List {% block js_load %} {{ block.super }} + {% endblock %} {% block js_ready %} diff --git a/InvenTree/part/templates/part/partial_delete.html b/InvenTree/part/templates/part/partial_delete.html index 6f2509996b..baa429e2a5 100644 --- a/InvenTree/part/templates/part/partial_delete.html +++ b/InvenTree/part/templates/part/partial_delete.html @@ -1,6 +1,11 @@ +{% extends "modal_form.html" %} + +{% block pre_form_content %} + Are you sure you want to delete part '{{ part.full_name }}'? {% if part.used_in_count %} +

    This part is used in BOMs for {{ part.used_in_count }} other parts. If you delete this part, the BOMs for the following parts will be updated: