Further assorted updates

What, you need more commit details?! Pah
This commit is contained in:
Oliver 2018-05-07 23:40:17 +10:00
parent b6944620dd
commit fdf214626c
5 changed files with 36 additions and 28 deletions

View File

@ -18,7 +18,6 @@
<ul class="dropdown-menu">
<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-delete' title='Delete selected stock items'>Delete</a></li>
</ul>
</div>
</div>
@ -111,19 +110,14 @@
return false;
});
$("#multi-item-delete").click(function() {
var items = selectedStock();
deleteStockItems(items, {});
return false;
});
$("#multi-item-stocktake").click(function() {
var items = selectedStock();
countStockItems(items, {});
countStockItems(items, {
success: function() {
$("#stock-table").bootstrapTable('refresh');
}
});
return false;
});

View File

@ -125,6 +125,8 @@ function countStockItems(items, options) {
]
});
$(modal).find('#stocktake-table').bootstrapTable('checkAll');
$(modal).on('click', '#modal-form-submit', function() {
var selections = $(modal).find('#stocktake-table').bootstrapTable('getSelections');

View File

@ -57,6 +57,23 @@ class StockItem(models.Model):
If a serial number is assigned, then StockItem cannot have a quantity other than 1
"""
def save(self, *args, **kwargs):
if not self.pk:
add_note = True
else:
add_note = False
super(StockItem, self).save(*args, **kwargs)
if add_note:
# This StockItem is being saved for the first time
self.add_transaction_note(
'Created stock item',
None,
system=True
)
def clean(self):
# The 'supplier_part' field must point to the same part!

View File

@ -118,7 +118,7 @@
{% if track.notes %}
<br>{{ track.notes }}
{% endif %}
<span class='badge'>{{ track.date }} - {{ track.user }}</span>
<span class='badge'>{{ track.date }}{% if track.user %} - {{ track.user }}{% endif %}</span>
</li>
{% endfor %}
</ul>

View File

@ -49,7 +49,6 @@
<ul class="dropdown-menu">
<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-delete' title='Delete selected stock items'>Delete</a></li>
</ul>
</div>
</div>
@ -127,20 +126,11 @@
var items = selectedStock();
moveStockItems(items,
{
success: function() {
$("#stock-table").bootstrapTable('refresh');
}
});
return false;
});
$("#multi-item-delete").click(function() {
var items = selectedStock();
deleteStockItems(items, {});
{
success: function() {
$("#stock-table").bootstrapTable('refresh');
}
});
return false;
});
@ -148,7 +138,12 @@
$("#multi-item-stocktake").click(function() {
var items = selectedStock();
countStockItems(items, {});
countStockItems(items,
{
success: function() {
$("#stock-table").bootstrapTable('refresh');
}
});
return false;
});