This commit is contained in:
Oliver Walters 2021-01-18 22:25:53 +11:00
parent 697a338700
commit 526d81481b
11 changed files with 51 additions and 82 deletions

View File

@ -1856,9 +1856,6 @@ class BomItem(models.Model):
self.clean() self.clean()
super().save(*args, **kwargs) super().save(*args, **kwargs)
def get_absolute_url(self):
return reverse('bom-item-detail', kwargs={'pk': self.id})
# A link to the parent part # A link to the parent part
# Each part will get a reverse lookup field 'bom_items' # Each part will get a reverse lookup field 'bom_items'
part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='bom_items', part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='bom_items',

View File

@ -1,10 +1,11 @@
{% load i18n %}
{% extends "modal_delete_form.html" %} {% extends "modal_delete_form.html" %}
{% block pre_form_content %} {% block pre_form_content %}
Are you sure you want to delete this BOM item? {% trans "Are you sure you want to delete this BOM item?" %}
<br> <br>
Deleting this entry will remove the BOM row from the following part: {% trans "Deleting this entry will remove the BOM row from the following part" %}:
<ul class='list-group'> <ul class='list-group'>
<li class='list-group-item'> <li class='list-group-item'>

View File

@ -1,18 +0,0 @@
{% extends "base.html" %}
{% block content %}
<h3>BOM Item</h3>
<table class="table table-striped">
<tr><td>Parent</td><td><a href="{% url 'part-bom' item.part.id %}">{{ item.part.full_name }}</a></td></tr>
<tr><td>Child</td><td><a href="{% url 'part-used-in' item.sub_part.id %}">{{ item.sub_part.full_name }}</a></td></tr>
<tr><td>Quantity</td><td>{{ item.quantity }}</td></tr>
</table>
<div class='container-fluid'>
<a href="{% url 'bom-item-edit' item.id %}"><button class="btn btn-info">Edit BOM item</button></a>
<a href="{% url 'bom-item-delete' item.id %}"><button class="btn btn-danger">Delete BOM item</button></a>
</div>
{% endblock %}

View File

@ -63,11 +63,11 @@
<span class='fas fa-file-download'></span> {% trans "Export" %} <span class='fas fa-file-download'></span> {% trans "Export" %}
</button> </button>
{% endif %} {% endif %}
</div>
<div class='filter-list' id='filter-list-bom'> <div class='filter-list' id='filter-list-bom'>
<!-- Empty div (will be filled out with avilable BOM filters) --> <!-- Empty div (will be filled out with avilable BOM filters) -->
</div> </div>
</div> </div>
</div>
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='bom-table'> <table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='bom-table'>
</table> </table>
@ -179,8 +179,8 @@
secondary: [ secondary: [
{ {
field: 'sub_part', field: 'sub_part',
label: 'New Part', label: '{% trans "New Part" %}',
title: 'Create New Part', title: '{% trans "Create New Part" %}',
url: "{% url 'part-create' %}", url: "{% url 'part-create' %}",
}, },
] ]

View File

@ -49,14 +49,14 @@
{% for row in bom_rows %} {% for row in bom_rows %}
<tr {% if row.errors %} style='background: #ffeaea;'{% endif %} part-name='{{ row.part_name }}' part-description='{{ row.description }}' part-select='#select_part_{{ row.index }}'> <tr {% if row.errors %} style='background: #ffeaea;'{% endif %} part-name='{{ row.part_name }}' part-description='{{ row.description }}' part-select='#select_part_{{ row.index }}'>
<td> <td>
<button class='btn btn-default btn-remove' onClick='removeRowFromBomWizard()' id='del_row_{{ forloop.counter }}' style='display: inline; float: right;' title='Remove row'> <button class='btn btn-default btn-remove' onClick='removeRowFromBomWizard()' id='del_row_{{ forloop.counter }}' style='display: inline; float: right;' title='{% trans "Remove row" %}'>
<span row_id='{{ forloop.counter }}' class='fas fa-trash-alt icon-red'></span> <span row_id='{{ forloop.counter }}' class='fas fa-trash-alt icon-red'></span>
</button> </button>
</td> </td>
<td></td> <td></td>
<td>{% add row.index 1 %}</td> <td>{% add row.index 1 %}</td>
<td> <td>
<button class='btn btn-default btn-create' onClick='newPartFromBomWizard()' id='new_part_row_{{ row.index }}' title='Create new part' type='button'> <button class='btn btn-default btn-create' onClick='newPartFromBomWizard()' id='new_part_row_{{ row.index }}' title='{% trans "Create new part" %}' type='button'>
<span row_id='{{ row.index }}' class='fas fa-plus icon-green'/> <span row_id='{{ row.index }}' class='fas fa-plus icon-green'/>
</button> </button>
<select class='select bomselect' id='select_part_{{ row.index }}' name='part_{{ row.index }}'> <select class='select bomselect' id='select_part_{{ row.index }}' name='part_{{ row.index }}'>

View File

@ -126,11 +126,11 @@
<li><a href='#' id='multi-part-export' title='{% trans "Export" %}'>{% trans "Export Data" %}</a></li> <li><a href='#' id='multi-part-export' title='{% trans "Export" %}'>{% trans "Export Data" %}</a></li>
</ul> </ul>
</div> </div>
</div>
<div class='filter-list' id='filter-list-parts'> <div class='filter-list' id='filter-list-parts'>
<!-- Empty div --> <!-- Empty div -->
</div> </div>
</div> </div>
</div>
{% block category_tables %} {% block category_tables %}

View File

@ -1,3 +1,4 @@
{% load i18n %}
{% extends "modal_form.html" %} {% extends "modal_form.html" %}
{% block pre_form_content %} {% block pre_form_content %}
@ -10,8 +11,8 @@
</div> </div>
{% if matches %} {% if matches %}
<b>Possible Matching Parts</b> <b>{% trans "Possible Matching Parts" %}</b>
<p>The new part may be a duplicate of these existing parts:</p> <p>{% trans "The new part may be a duplicate of these existing parts" %}:</p>
<ul class='list-group'> <ul class='list-group'>
{% for match in matches %} {% for match in matches %}
<li class='list-group-item list-group-item-condensed'> <li class='list-group-item list-group-item-condensed'>

View File

@ -1,3 +1,4 @@
{% load i18n %}
{% extends "modal_form.html" %} {% extends "modal_form.html" %}
{% block pre_form_content %} {% block pre_form_content %}
@ -5,8 +6,8 @@
{{ block.super }} {{ block.super }}
<div class='alert alert-info alert-block'> <div class='alert alert-info alert-block'>
<b>Create new part variant</b><br> <b>{% trans "Create new part variant" %}</b><br>
Create a new variant of template <i>'{{ part.full_name }}'</i>. {% trans "Create a new variant of template" %} <i>'{{ part.full_name }}'</i>.
</div> </div>
{% endblock %} {% endblock %}

View File

@ -99,8 +99,6 @@ part_category_urls = [
part_bom_urls = [ part_bom_urls = [
url(r'^edit/?', views.BomItemEdit.as_view(), name='bom-item-edit'), url(r'^edit/?', views.BomItemEdit.as_view(), name='bom-item-edit'),
url('^delete/?', views.BomItemDelete.as_view(), name='bom-item-delete'), url('^delete/?', views.BomItemDelete.as_view(), name='bom-item-delete'),
url(r'^.*$', views.BomItemDetail.as_view(), name='bom-item-detail'),
] ]
# URL list for part web interface # URL list for part web interface

View File

@ -2411,15 +2411,6 @@ class CategoryParameterTemplateDelete(AjaxDeleteView):
return self.object return self.object
class BomItemDetail(InvenTreeRoleMixin, DetailView):
""" Detail view for BomItem """
context_object_name = 'item'
queryset = BomItem.objects.all()
template_name = 'part/bom-detail.html'
role_required = 'part.view'
class BomItemCreate(AjaxCreateView): class BomItemCreate(AjaxCreateView):
""" Create view for making a new BomItem object """ """ Create view for making a new BomItem object """
model = BomItem model = BomItem

View File

@ -214,7 +214,6 @@ function loadBomTable(table, options) {
}, },
}); });
if (!options.editable) {
cols.push( cols.push(
{ {
field: 'sub_part_detail.stock', field: 'sub_part_detail.stock',
@ -254,7 +253,6 @@ function loadBomTable(table, options) {
} }
}); });
*/ */
}
cols.push( cols.push(
{ {