Force draw objects in front of others
I have a somewhat imperfect solution for you, but I think you could work it up into a perfect one.


That's a very raw render from the technique I'm suggesting.


And here's the compositor node tree.

I've used two render layers, one for the flask and another for the triangle. I've also given both objects Object IDs and the layers Object ID passes. Rendering uses the Transparent setting in the Film section.

Take the Object ID masks from the two layers/objects, and use the Math converter "Minimum" to create a binary mask of their overlapping areas.

Feed that into an Alpha Over node that takes as its input two versions of the flask layer, one opaque and the other translucent.

Then some more jiggery pokery to make sure that the transparency of the background is preserved, because otherwise it would obscure the triangle. That takes the Minimum of the Alpha values from the previous Alpha Over node and the original Layer.

Then another Alpha Over with the mixed-alpha flask as the second input. It shows the flask in front with the triangle visible through a translucent section.

Unfortunately there is no refraction, as there would be with rays cast through glass. You might be able to achieve it with a more complex set up, if you want to. But as it is, the flask is always in front but with the triangle visible.

Please forgive the crudeness of the models and render.

Edit: Slightly better example: