mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add part stocktake to Stock Location page(s)
This commit is contained in:
parent
f2982a59ad
commit
bf4ffb8b0b
@ -7,15 +7,11 @@ function deleteButton(url, text='Delete') {
|
||||
}
|
||||
|
||||
function renderLink(text, url) {
|
||||
if (text && url) {
|
||||
return '<a href="' + url + '">' + text + '</a>';
|
||||
}
|
||||
else if (text) {
|
||||
if (text === '' || url === '') {
|
||||
return text;
|
||||
}
|
||||
else {
|
||||
return '';
|
||||
}
|
||||
|
||||
return '<a href="' + url + '">' + text + '</a>';
|
||||
}
|
||||
|
||||
|
||||
|
@ -194,8 +194,6 @@ class StockItem(models.Model):
|
||||
|
||||
@property
|
||||
def in_stock(self):
|
||||
if self.quantity == 0:
|
||||
return False
|
||||
|
||||
if self.belongs_to or self.customer:
|
||||
return False
|
||||
@ -284,6 +282,9 @@ class StockItem(models.Model):
|
||||
""" Remove items from stock
|
||||
"""
|
||||
|
||||
if self.quantity == 0:
|
||||
return
|
||||
|
||||
quantity = int(quantity)
|
||||
|
||||
if quantity <= 0 or self.infinite:
|
||||
|
@ -47,6 +47,8 @@
|
||||
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Options
|
||||
<span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#" id='multi-item-add' title='Add to selected stock items'>Add stock</a></li>
|
||||
<li><a href="#" id='multi-item-remove' title='Remove from selected stock items'>Remove stock</a></li>
|
||||
<li><a href="#" id='multi-item-stocktake' title='Stocktake selected stock items'>Stocktake</a></li>
|
||||
<li><a href='#' id='multi-item-move' title='Move selected stock items'>Move</a></li>
|
||||
</ul>
|
||||
@ -130,16 +132,28 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#multi-item-stocktake").click(function() {
|
||||
var items = selectedStock();
|
||||
function _stock(action) {
|
||||
adjustStock({
|
||||
action: action,
|
||||
items: selectedStock(),
|
||||
success: function() {
|
||||
$('#stock-table').bootstrapTable('refresh');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
countStockItems(items,
|
||||
{
|
||||
success: function() {
|
||||
$("#stock-table").bootstrapTable('refresh');
|
||||
}
|
||||
});
|
||||
$('#multi-item-stocktake').click(function() {
|
||||
_stock('stocktake');
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#multi-item-remove').click(function() {
|
||||
_stock('remove');
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#multi-item-add').click(function() {
|
||||
_stock('add');
|
||||
return false;
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user