From 505502dd310feeddca08dc15fc2f36f0d138697d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= <> Date: Tue, 9 Jun 2009 17:37:28 +0200 Subject: [PATCH] [FIX] availability of prodlot check when assigning a prodlot to a move: non optimal location_id control lp bug: https://launchpad.net/bugs/338329 fixed bzr revid: christophe@tinyerp.com-20090609153728-avsw10uatlyzegub --- addons/stock/stock.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index a95234a7c61..9c69d3f068b 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -981,10 +981,12 @@ class stock_move(osv.osv): ON stock_move (location_id, location_dest_id, product_id, state)') cursor.commit() - def onchange_lot_id(self, cr, uid, context, prodlot_id=False,product_qty=False, loc_id=False): + def onchange_lot_id(self, cr, uid, context=None, prodlot_id=False, product_qty=False, loc_id=False): if not prodlot_id or not loc_id: return {} - prodlot = self.pool.get('stock.production.lot').browse(cr, uid, prodlot_id) + ctx = context and context.copy() or {} + ctx['location_id'] = loc_id + prodlot = self.pool.get('stock.production.lot').browse(cr, uid, prodlot_id, ctx) location=self.pool.get('stock.location').browse(cr,uid,loc_id) warning={} if (location.usage == 'internal') and (product_qty > (prodlot.stock_available or 0.0)):