[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
This commit is contained in:
Raphaël Valyi 2009-06-09 17:37:28 +02:00 committed by Christophe Simonis
parent 3303c43d7d
commit 505502dd31
1 changed files with 4 additions and 2 deletions

View File

@ -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)):