Add action to uninstall a particular stock item

This commit is contained in:
Oliver Walters 2020-09-29 23:11:37 +10:00
parent 9e4a599c44
commit 1f6cbd7408
2 changed files with 25 additions and 3 deletions

View File

@ -107,6 +107,11 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
{% if item.customer %} {% if item.customer %}
<li><a href='#' id='stock-return-from-customer' title='{% trans "Return to stock" %}'><span class='fas fa-undo'></span> {% trans "Return to stock" %}</a></li> <li><a href='#' id='stock-return-from-customer' title='{% trans "Return to stock" %}'><span class='fas fa-undo'></span> {% trans "Return to stock" %}</a></li>
{% endif %} {% endif %}
{% if item.belongs_to %}
<li>
<a href='#' id='stock-uninstall' title='{% trans "Uninstall stock item" %}'><span class='fas fa-unlink'></span> {% trans "Uninstall" %}</a>
</li>
{% endif %}
</ul> </ul>
</div> </div>
<!-- Edit stock item --> <!-- Edit stock item -->
@ -165,8 +170,12 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
{% if item.belongs_to %} {% if item.belongs_to %}
<tr> <tr>
<td><span class='fas fa-box'></span></td> <td><span class='fas fa-box'></span></td>
<td>{% trans "Belongs To" %}</td> <td>
<td><a href="{% url 'stock-item-detail' item.belongs_to.id %}">{{ item.belongs_to }}</a></td> {% trans "Installed In" %}
</td>
<td>
<a href="{% url 'stock-item-detail' item.belongs_to.id %}">{{ item.belongs_to }}</a>
</td>
</tr> </tr>
{% elif item.sales_order %} {% elif item.sales_order %}
<tr> <tr>
@ -301,6 +310,19 @@ $("#stock-serialize").click(function() {
); );
}); });
$('#stock-uninstall').click(function() {
launchModalForm(
"{% url 'stock-item-uninstall' %}",
{
data: {
'items[]': [{{ item.pk}}],
},
reload: true,
}
);
});
$("#stock-test-report").click(function() { $("#stock-test-report").click(function() {
launchModalForm( launchModalForm(
"{% url 'stock-item-test-report-select' item.id %}", "{% url 'stock-item-test-report-select' item.id %}",

View File

@ -128,7 +128,7 @@ $('#installed-table').inventreeTable({
var html = `<div class='btn-group float-right' role='group'>`; var html = `<div class='btn-group float-right' role='group'>`;
html += makeIconButton('fa-trash-alt icon-red', 'button-uninstall', pk, '{% trans "Uninstall item" %}'); html += makeIconButton('fa-unlink', 'button-uninstall', pk, '{% trans "Uninstall item" %}');
html += `</div>`; html += `</div>`;