From efe20e105cac9ad2ca42a3abd1d038da820a8ab6 Mon Sep 17 00:00:00 2001 From: Bertrand Chenal Date: Tue, 20 May 2008 19:15:50 +0200 Subject: [PATCH] Fix: avoid to create inventory lines with negatove quantity --- inventory.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inventory.py b/inventory.py index 6a1e4519ea..dfcf8a3ea2 100644 --- a/inventory.py +++ b/inventory.py @@ -216,8 +216,12 @@ class CompleteInventory(Wizard): for inventory in inventories: products = [line.product.id for line in inventory.lines] for (product, uom, qty) in indexed_data[inventory.location.id]: + # Skip products already in the inventory: if product in products: continue + if qty <= 0.0: + qty = 0 + if product in products: continue line_obj.create( cursor, user, {'product': product,