From 200f95d0b2cc00389c00ecaae62f61b9efcf85c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Najla=C3=A2?= Date: Tue, 24 Apr 2012 17:19:04 +0200 Subject: [PATCH] [FIX] stock: check if the move exists to avoid the key error bzr revid: nel@tinyerp.com-20120424151904-9i6y2hus5v21asg3 --- addons/stock/wizard/stock_return_picking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/wizard/stock_return_picking.py b/addons/stock/wizard/stock_return_picking.py index 689f17cd9b9..c7d4b1e59b6 100644 --- a/addons/stock/wizard/stock_return_picking.py +++ b/addons/stock/wizard/stock_return_picking.py @@ -100,7 +100,7 @@ class stock_return_picking(osv.osv_memory): valid_lines = 0 return_history = self.get_return_history(cr, uid, record_id, context) for m in pick.move_lines: - if m.product_qty * m.product_uom.factor > return_history[m.id]: + if return_history.get(m.id) and m.product_qty * m.product_uom.factor > return_history[m.id]: valid_lines += 1 if not valid_lines: raise osv.except_osv(_('Warning !'), _("There are no products to return (only lines in Done state and not fully returned yet can be returned)!"))