The certificate of completion template used should be that of the portal that the course resides in, not the portal the user happens to be logged into.