[IMP] sale_mrp: performance improvement: '_get_sale_ref' now uses browse instead of read

bzr revid: olt@tinyerp.com-20100928122807-5sy8lypoo31up2e0
This commit is contained in:
olt@tinyerp.com 2010-09-28 14:28:07 +02:00
parent e49a06c518
commit 02ab26f946
1 changed files with 7 additions and 7 deletions

View File

@ -58,17 +58,17 @@ class mrp_production(osv.osv):
return move_id
res = {}
productions = self.read(cr, uid, ids, ['id','move_prod_id'])
productions = self.browse(cr, uid, ids)
for production in productions:
res[production['id']] = False
if production.get('move_prod_id',False):
parent_move_line = get_parent_move(production['move_prod_id'][0])
res[production.id] = False
if production.move_prod_id:
parent_move_line = get_parent_move(production.move_prod_id)
if parent_move_line:
move = move_obj.browse(cr,uid,parent_move_line)
if field_name == 'name':
res[production['id']] = move.sale_line_id and move.sale_line_id.order_id.name or False
res[production.id] = move.sale_line_id and move.sale_line_id.order_id.name or False
if field_name == 'client_order_ref':
res[production['id']] = move.sale_line_id and move.sale_line_id.order_id.client_order_ref or False
res[production.id] = move.sale_line_id and move.sale_line_id.order_id.client_order_ref or False
return res
_columns = {
@ -78,4 +78,4 @@ class mrp_production(osv.osv):
mrp_production()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: