From 32474a6865d233df90be46f19cd783446c37f3b4 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Mon, 3 Apr 2017 16:03:22 -0300 Subject: [PATCH] Don't update input when unchecking --- kfet/templates/kfet/inventory_create.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kfet/templates/kfet/inventory_create.html b/kfet/templates/kfet/inventory_create.html index 61792c6d..1098f1f8 100644 --- a/kfet/templates/kfet/inventory_create.html +++ b/kfet/templates/kfet/inventory_create.html @@ -101,7 +101,7 @@ $(document).ready(function() { * Remove warning and update stock */ - function update_stock($line) { + function update_stock($line, update_count) { $line.removeClass('inventory_modified'); $line.find('.inventory_update').hide(); @@ -110,7 +110,7 @@ $(document).ready(function() { $line.find('.current_stock').text(old_stock + stock_diff); $line.find('.stock_diff').text(''); - if ($line.find('.stock_new input').val() && stock_diff) { + if ($line.find('.stock_new input').val() && update_count) { var old_misc = +$line.find('.misc input').val(); $line.find('.misc input').val(old_misc + stock_diff) .trigger('input'); @@ -122,12 +122,12 @@ $(document).ready(function() { $('.finished input').change(function() { var $line = $(this).closest('tr'); - update_stock($line); + update_stock($line, false); }); $('.inventory_update button').click(function() { var $line = $(this).closest('tr'); - update_stock($line); + update_stock($line, true); });