'Explodes pickings'

def action_explode(self):

    if (not self.picking_type_id):
        return self
    bom = self.env['mrp.bom'].sudo()._bom_find(product=self.product_id)
    if ((not bom) or (bom.type != 'phantom')):
        return self
    phantom_moves = self.env['stock.move']
    processed_moves = self.env['stock.move']
    factor = (self.product_uom._compute_quantity(self.product_uom_qty, bom.product_uom_id) / bom.product_qty)
    (boms, lines) = bom.sudo().explode(self.product_id, factor, picking_type=bom.picking_type_id)
    for (bom_line, line_data) in lines:
        phantom_moves += self._generate_move_phantom(bom_line, line_data['qty'])
    for new_move in phantom_moves:
        processed_moves |= new_move.action_explode()
    if ((not self.split_from) and self.procurement_id):
        moves = self.procurement_id.move_ids
        if (len(moves) == 1):
            self.procurement_id.write({'state': 'done'})
    if (processed_moves and (self.state == 'assigned')):
        processed_moves.write({'state': 'assigned'})
    self.sudo().unlink()
    return processed_moves
