From 38fb52a964cd0a235fa0239a4bce9d85ee6f50fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 5 Dec 2008 13:53:30 +0100 Subject: [PATCH] Fix complete_lines to set only stockable products --- inventory.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/inventory.py b/inventory.py index 3be3009228..7b43b3df70 100644 --- a/inventory.py +++ b/inventory.py @@ -137,9 +137,12 @@ class Inventory(OSV): # Index some data product2uom = {} - for product in product_obj.browse( - cursor, user, [line[1] for line in pbl], context=context): + product2type = {} + for product in product_obj.browse(cursor, user, + [line[1] for line in pbl], context=context): product2uom[product.id] = product.default_uom.id + product2type[product.id] = product.type + product_qty = {} for (location, product), quantity in pbl.iteritems(): product_qty[product] = (quantity, product2uom[product]) @@ -169,6 +172,8 @@ class Inventory(OSV): # Create lines if needed for product in product_qty: + if product2type[product] != 'stockable': + continue quantity, uom_id = product_qty[product] values = { 'product': product,