[Fix] stock: stock_move wizard check if active find in context then set the default value

bzr revid: sbh@tinyerp.com-20100618095321-5w8gf82phwtl0or7
This commit is contained in:
sbh (Open ERP)
2010-06-18 15:23:21 +05:30
parent 77fc796e7f
commit 446c987377
+10 -9
View File
@@ -176,15 +176,16 @@ class split_in_production_lot(osv.osv_memory):
"""
res = super(split_in_production_lot, self).default_get(cr, uid, fields, context=context)
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
if 'product_id' in fields:
res.update({'product_id': move.product_id.id})
if 'product_uom' in fields:
res.update({'product_uom': move.product_uom.id})
if 'qty' in fields:
res.update({'qty': move.product_qty})
if 'use_exist' in fields:
res.update({'use_exist': (move.picking_id and move.picking_id.type=='out' and True) or False})
if context.get('active_id'):
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
if 'product_id' in fields:
res.update({'product_id': move.product_id.id})
if 'product_uom' in fields:
res.update({'product_uom': move.product_uom.id})
if 'qty' in fields:
res.update({'qty': move.product_qty})
if 'use_exist' in fields:
res.update({'use_exist': (move.picking_id and move.picking_id.type=='out' and True) or False})
return res
_columns = {