4
class mrp_bom(osv.osv):
6
def _child_compute(self, cr, uid, ids, name, arg, context={}):
8
for bom in self.browse(cr, uid, ids, context=context):
9
result[bom.id] = map(lambda x: x.id, bom.bom_lines)
10
ok = ((name=='child_complete_ids') and (bom.product_id.supply_method=='produce'))
11
if bom.type=='phantom' or ok:
12
sids = self.pool.get('mrp.bom').search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)])
14
bom2 = self.pool.get('mrp.bom').browse(cr, uid, sids[0], context=context)
15
result[bom.id] += map(lambda x: x.id, bom2.bom_lines)
18
'child_ids': fields.function(_child_compute,relation='mrp.bom', method=True, string="BoM Hyerarchy", type='many2many'),
19
'child_complete_ids': fields.function(_child_compute,relation='mrp.bom', method=True, string="BoM Hyerarchy", type='many2many')