From fe9a56a5c17ad1b99b7a4a587d1edcb96cdba111 Mon Sep 17 00:00:00 2001 From: Oliver <oliver.henry.walters@gmail.com> Date: Mon, 2 Oct 2023 22:49:10 +1100 Subject: [PATCH] Allow stocktake quantity to be zero (#5644) - Backport of https://github.com/inventree/InvenTree/pull/5627/ Co-authored-by: Oliver Lippert <oliver@allesit.de> --- InvenTree/part/tasks.py | 4 ---- InvenTree/part/test_api.py | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/InvenTree/part/tasks.py b/InvenTree/part/tasks.py index 23781fd839..712596acfc 100644 --- a/InvenTree/part/tasks.py +++ b/InvenTree/part/tasks.py @@ -314,10 +314,6 @@ def generate_stocktake_report(**kwargs): # Create a new stocktake for this part (do not commit, this will take place later on) stocktake = perform_stocktake(p, user, commit=False) - if stocktake.quantity == 0: - # Skip rows with zero total quantity - continue - total_parts += 1 stocktake_instances.append(stocktake) diff --git a/InvenTree/part/test_api.py b/InvenTree/part/test_api.py index e39b86365d..d3a47df754 100644 --- a/InvenTree/part/test_api.py +++ b/InvenTree/part/test_api.py @@ -2966,7 +2966,7 @@ class PartStocktakeTest(InvenTreeAPITestCase): data = response.data[0] - self.assertEqual(data['part_count'], 8) + self.assertEqual(data['part_count'], 14) self.assertEqual(data['user'], None) self.assertTrue(data['report'].endswith('.csv'))