Not always so.
For example, CX have on their website a flight to Hanoi under a codeshare with VN. Flt number is CX1791/VN791
Flight is strangely enough operated by VN.
Can you buy an ID90 with VN - Nup!
Can you buy a CX ZED ticket to Hanoi - Nup!
I believe it merely depends on whether there is an interline ticketing agreement with the company in question.