Stock counting now works

This commit is contained in:
Oliver Walters 2019-06-02 12:20:26 +10:00
parent d365d7cc44
commit 2ee35ec062
3 changed files with 14 additions and 7 deletions

View File

@ -564,10 +564,7 @@ function loadStockTable(table, options) {
// Automatically link button callbacks
$('#multi-item-stocktake').click(function() {
updateStockItems({
action: 'stocktake',
});
return false;
stockAdjustment('count');
});
$('#multi-item-remove').click(function() {

View File

@ -358,7 +358,17 @@ class StockAdjust(AjaxView, FormMixin):
return _("Removed stock from {n} items".format(n=count))
def do_count(self):
pass
count = 0
note = self.request.POST['note']
for item in self.stock_items:
item.stocktake(item.new_quantity, self.request.user, notes=note)
count += 1
return _("Counted stock for {n} items".format(n=count))
def do_move(self, destination):
""" Perform actual stock movement """

View File

@ -8,8 +8,8 @@
<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>
<li><a href="#" id='multi-item-stocktake' title='Stocktake selected stock items'>Count stock</a></li>
<li><a href='#' id='multi-item-move' title='Move selected stock items'>Move stock</a></li>
</ul>
</div>
</div>