antena 315mhz pcb trace
Your layout stinks! If there is no ground plane under that long meandering line, then it is not a 50 ohm transmission line! It might look more like a big inductor.
So your module probably does not work well when you try to attach an antenna to the connector.
It probably works better when you do not attach anything to the connector! But if you want to make it work well without an external antenna, the best thing would be to resonate the loop, as probably explained above.
You can not have it both ways! If you put a ground plane under the line, it will no longer act like a loop antenna. If you do not put a ground plane underthe line, it will not act as a 50 ohm line for the external antenna.
Maybe, just maybe, you can have it both ways if you had a jumper selection for internal loop or external antenna.