[FIX] mrp: Task ID 583: Fixed bug when printing BoM structure report.

bzr revid: uco@tinyerp.co.in-20100423111030-kejyf76lxdwpgrxc
This commit is contained in:
uco (OpenERP) 2010-04-23 16:40:30 +05:30
parent 8090f6c91a
commit ab65a9c67c
1 changed files with 7 additions and 2 deletions

View File

@ -162,9 +162,14 @@ class mrp_bom(osv.osv):
"""
result = {}
bom_obj = self.pool.get('mrp.bom')
bom_parent = bom_obj.browse(cr, uid, context['active_id'])
bom_id = context and context.get('active_id', False) or False
cr.execute('select id from mrp_bom')
if all(bom_id != r[0] for r in cr.fetchall()):
ids.sort()
bom_id = ids[0]
bom_parent = bom_obj.browse(cr, uid, bom_id)
for bom in self.browse(cr, uid, ids, context=context):
if bom_parent.multi_level_bom or bom.id == context['active_id']:
if (bom_parent and bom_parent.multi_level_bom) or bom.id == bom_id:
result[bom.id] = map(lambda x: x.id, bom.bom_lines)
else:
result[bom.id] = []