mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Cleanup
This commit is contained in:
parent
697a338700
commit
526d81481b
@ -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',
|
||||||
|
@ -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'>
|
||||||
|
@ -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 %}
|
|
@ -63,9 +63,9 @@
|
|||||||
<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>
|
||||||
|
|
||||||
@ -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' %}",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -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 }}'>
|
||||||
|
@ -126,9 +126,9 @@
|
|||||||
<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>
|
||||||
|
|
||||||
|
@ -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'>
|
||||||
|
@ -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 %}
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -214,47 +214,45 @@ function loadBomTable(table, options) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!options.editable) {
|
cols.push(
|
||||||
cols.push(
|
{
|
||||||
{
|
field: 'sub_part_detail.stock',
|
||||||
field: 'sub_part_detail.stock',
|
title: '{% trans "Available" %}',
|
||||||
title: '{% trans "Available" %}',
|
searchable: false,
|
||||||
searchable: false,
|
sortable: true,
|
||||||
sortable: true,
|
formatter: function(value, row, index, field) {
|
||||||
formatter: function(value, row, index, field) {
|
|
||||||
|
|
||||||
var url = `/part/${row.sub_part_detail.pk}/stock/`;
|
var url = `/part/${row.sub_part_detail.pk}/stock/`;
|
||||||
var text = value;
|
var text = value;
|
||||||
|
|
||||||
if (value == null || value <= 0) {
|
if (value == null || value <= 0) {
|
||||||
text = `<span class='label label-warning'>{% trans "No Stock" %}</span>`;
|
text = `<span class='label label-warning'>{% trans "No Stock" %}</span>`;
|
||||||
}
|
|
||||||
|
|
||||||
return renderLink(text, url);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
return renderLink(text, url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// TODO - Re-introduce the pricing column at a later stage,
|
/*
|
||||||
// once the pricing has been "fixed"
|
|
||||||
// O.W. 2020-11-24
|
|
||||||
|
|
||||||
cols.push(
|
// TODO - Re-introduce the pricing column at a later stage,
|
||||||
{
|
// once the pricing has been "fixed"
|
||||||
field: 'price_range',
|
// O.W. 2020-11-24
|
||||||
title: '{% trans "Price" %}',
|
|
||||||
sortable: true,
|
cols.push(
|
||||||
formatter: function(value, row, index, field) {
|
{
|
||||||
if (value) {
|
field: 'price_range',
|
||||||
return value;
|
title: '{% trans "Price" %}',
|
||||||
} else {
|
sortable: true,
|
||||||
return "<span class='warning-msg'>{% trans "No pricing available" %}</span>";
|
formatter: function(value, row, index, field) {
|
||||||
}
|
if (value) {
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
return "<span class='warning-msg'>{% trans "No pricing available" %}</span>";
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
*/
|
});
|
||||||
}
|
*/
|
||||||
|
|
||||||
cols.push(
|
cols.push(
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user