mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add function to un-link barcode from a stock item
This commit is contained in:
parent
beccbe8583
commit
ba94b340dd
@ -22,6 +22,36 @@ function scanBarcode(barcode, options={}) {
|
||||
}
|
||||
|
||||
|
||||
function unlinkBarcode(stockitem) {
|
||||
/*
|
||||
* Remove barcode association from a device.
|
||||
*/
|
||||
|
||||
showQuestionDialog(
|
||||
"Unlink Barcode",
|
||||
"Remove barcode association from this Stock Item",
|
||||
{
|
||||
accept_text: "Unlink",
|
||||
accept: function() {
|
||||
inventreePut(
|
||||
`/api/stock/${stockitem}/`,
|
||||
{
|
||||
// Clear the UID field
|
||||
uid: '',
|
||||
},
|
||||
{
|
||||
method: 'PATCH',
|
||||
success: function(response, status) {
|
||||
location.reload();
|
||||
},
|
||||
},
|
||||
);
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Associate barcode data with a StockItem
|
||||
*/
|
||||
|
@ -80,6 +80,9 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
|
||||
<li><a href='#' id='show-qr-code'><span class='fas fa-qrcode'></span> {% trans "Show QR Code" %}</a></li>
|
||||
<li><a href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li>
|
||||
<li><a href='#' id='link-barcode'><span class='fas fa-link'></span> {% trans "Link Barcode" %}</a></li>
|
||||
{% if item.uid %}
|
||||
<li><a href='#' id='unlink-barcode'><span class='fas fa-unlink'></span> {% trans "Unlink Barcode" %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% if item.in_stock %}
|
||||
@ -335,6 +338,10 @@ $("#show-qr-code").click(function() {
|
||||
});
|
||||
});
|
||||
|
||||
$("#unlink-barcode").click(function() {
|
||||
unlinkBarcode({{ item.id }});
|
||||
});
|
||||
|
||||
{% if item.in_stock %}
|
||||
|
||||
{% if item.part.salable %}
|
||||
|
Loading…
Reference in New Issue
Block a user